HTTP Error 403.14 - Forbidden. Asp.NET MVC

2019-09-11 15:10发布

问题:

Am trying to locally host an ASP.NET MVC project on IIS 10 (windows 10 machine). But when I try to access the site I get a "HTTP Error 403.14 - Forbidden" error. The contents of the Web.Config file as well as the error on the loading page are below. Is there something else am missing? Please suggest.

Update: Finally I figured out the issue. This is a webapi project so in the Global.asax.cs I forgot to register the route for the MVC controller which am using.

Thank you for all the suggestions.

回答1:

This check:

  • ~\Views\todoapp
  • ~\Views\todoapp\index.cshtml
  • ~\Controllers\todoappController.cs
  • ~\Controllers\todoappController.cs --> public ActionResult Index() { return View(); }

If the problem can not be found,Check this file:

  • ~\Views\Web.config


回答2:

Just create virtual directory of project and run it on IIS.

  1. Open Visual Studio (Run as administrator).
  2. Select your site under IIS Express Sites.
  3. Right click on Project / Site and click on Properties.
  4. Click on Website menu and New Virtual Directory.
  5. Give Alias Name and Folder path.
  6. Save The Setting and click ok.

Now run same as given alias name and path

Like, http://localhost/ProjectName/Home/Index