2

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?

Sicco
  • 6,167
  • 5
  • 45
  • 61
user1662008
  • 297
  • 1
  • 5
  • 17
  • I'm just now seeing something very similar when I renamed one of my controllers to "PropertiesController". Other routes are working just fine. When I renamed it something like "PropController" it works, but "PropertiesController" gives the 404.20 - no default document. – Aaron Wagner Sep 18 '12 at 21:45
  • Any idea why its happening..i am totally clueless here...I have looked at configuration file multiple times but not able to figure out – user1662008 Sep 20 '12 at 19:10
  • Not sure if this is the same for you, but in my case the Properties folder in the project was being found by the routing engine before it looks at the controller collection and this causes my problem. I haven't figured out a workaround yet. – Aaron Wagner Sep 20 '12 at 20:12
  • what does url for your site look like? – Grzegorz W Oct 02 '12 at 12:12

0 Answers0