I'm running Windows 7 Ultimate (64 bit) using Visual Studio 2010 RC. I recently decided to have VS run/debug my apps on IIS rather than the dev server that comes with it.
However, every time I try to run an MVC app, I get the following error:
HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory. Detailed
Error Information
Module DirectoryListingModule
Notification ExecuteRequestHandler
Handler StaticFile Error
Code 0x00000000 Requested
URL http://localhost:80/mySite/
Physical Path C:\myProject\mySite\
Logon Method Anonymous Logon
User Anonymous
I placed a default.aspx
file in the directory and I received the following error:
HTTP Error 500.21 - Internal Server Error Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list
Are there any other steps I forgot to take to get this working?
Notes: I installed IIS 7.5 after installing VS 2010 RC. I used the built-in "Create Virtual Directory" button under the "Web" tab in the MVC project's "Properties" in Visual Studio 2010. I made sure that the application is using the ASP.NET 4 App Pool.
Below are the installed features of IIS I have.
Make sure you have is the following set in your web.config:
Better solution:
Even though above solution works absolutely fine, it can cause other problem as it runs all your registered HTTP modules on every request (even on every request of .jpg .gif .css .html .pdf etc) and it is obviously waste of resource. Instead
Make sure preCondition attribute is empty means it will run on all requests. [Read more](http://www.britishdeveloper.co.uk/2010/06/dont-use-modules-runallmanagedmodulesfo.html,"Read original post")
We had a MVC application moved to a new server. .NET 4 and MVC 3 was installed, but we still got “Error 403.14″. In this case, this meant that IIS did not understand that it was dealing with a MVC application, it was looking for the default page.
The solution was simple: HTTP Redirection was not installed on the server.
Server Manager – Roles – Web Server (IIS) – Roles Services – HTTP Redirection: Not installed. Installed it, problem solved.
Yet another reason this can happen - your
RouteConfig.cs
orWebApiConfig.cs
are invalid.In my case, I had a route defined as such (note the parenthesis instead of curly brace):
If you're running IIS 8.5 on Windows 8, or Server 2012, you might find that running mvc 4/5 (.net 4.5) doesn't work in a virtual directory. If you create a local host entry in the host file to point back to your local machine and then point a new local IIS website to that folder (with the matching host header entry) you'll find it works then.
For me, the solution was to add the NuGet package Microsoft.AspNet.WebPages (plus it's Razor and Infrastructure dependencies) to my web project.
Infrastructure had to be forcefully reinstalled as it was not added as a reference at first.
Another possible solution, if you move around your global.asax, make sure the markup points to the correct MvcApplication class. Hopefully this will save someone in future.