I have an Asp.Net MVC 2 web application deployed on IIS 7.5 on .Net 4.0. When I select application pool as Asp.Net v4.0 Classic I get the following error.
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
The same application works fine when I select application pool as Asp.Net v4.0 Integrated. Does anyone know what is the reason for this?
Update: I followed the steps from the folowing url.
http://www.asp.net/mvc/tutorials/using-asp-net-mvc-with-different-versions-of-iis-cs
I have added a map for .mvc extension and also modified the Routing as shown below.
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}.mvc/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
routes.MapRoute(
"Root",
"",
new { controller = "Home", action = "Index", id = "" }
Now the following url is working fine and I can see the Home/Index page.
http://myapp/home.mvc
But this still gives the same error (HTTP Error 403.14 – Forbidden)
http://myapp/
This should have worked since I have mapped the Root to Home/Index action.
Update
This is on IIS 7.5 on a Win 7 Ultimate Turbo Gold Premium 64 bit system. The app pool was running in integrated mode. When I switched to classic everything works as advertised. If I run my app in classic mode, public access is granted like it should be. So here is the question: How do I run this in integrated mode if I want?
With classic mode you need to either do a wildcard mapping or use the “.mvc” extensions on your controller names in the URIs. So you’d have to change the *.mvc mapping in your IIS ASP.NET configuration to . or change your default route to something like:
These methods certainly do work; indeed, it’s the only way to support IIS 5-6. On the other hand, with IIS 7 I’d just use integrated mode.