Diagnosing 404 errors on IIS 7 and ASP.NET MVC

Stuart picture Stuart · Apr 1, 2009 · Viewed 49k times · Source

I have an mvc app developed and tested with Cassini. Deployed to my site on GoDaddy, and the default page comes up fine. Click to log in, and I get a 404.

I'm running under IIS 7 there, so this is unexpected. My routes are pretty plain:

        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            "Default",                                              
            "{controller}/{action}/{id}",                           
            new { controller = "Public", action = "Index", id = "" } 
        );
        routes.MapRoute(
            "Report1",
            "Report/{action}/{start}/{end}",
            new { controller = "Report", action = "Index" }
        );
        routes.MapRoute(
            "Report2",
            "Report/{action}/{start}/{end}/{idList}",
            new { controller = "Report", action = "Index" }
        );

Any idea what might be going on or how I can troubleshoot this?

Answer

mmx picture mmx · Apr 1, 2009

Are you running in IIS7 integrated mode?

Classic mode of IIS7 does not automatically map extensionless URLs to ASP.NET (much like IIS6).

Also make sure your Web.config <system.webServer> tag is configured correctly.