I have an existing MVC3 application and I want to run that using IIS 7.5 express. When I try to do that I get the following error:
HTTP Error 404.20 - Not Found
No default document.
Most likely causes:
•A default document is not configured for the site.
•The URL contains a typographical error.
•Directory browsing is not enabled.
If I create a new MVC application and run that, it works fine. I compared the route maps and did not see any difference For my application:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Program", action = "List", id = UrlParameter.Optional } // Parameter defaults
);
}
For the sample application:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
The controller and action mentioned are available.
I also looked at applicationhost.config
file and saw default documents as:
<defaultDocument enabled="true">
<files>
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="index.html" />
<add value="iisstart.htm" />
<add value="default.aspx" />
</files>
</defaultDocument>
Any suggestions on how to fix this error?