R – ASP.NET MVC – .mvc Routing just fails in II6

asp.net-mvciis-6routing

I have been banging my head against a brick wall trying to deploy my MVC app on IIS6 (linked question)

I have scrapped wildcard mapping for the time being and am trying to get the .mvc extension working. Everything is configured correctly in IIS and the .mvc extension is pointing to the .NET dll for all verb types (unchecked verify if exists option).

Each time I make a request, all I get is the .NET 404 page. /Home.mvc and /Home.mvc/Index all return that page.

I have not made any changes to the default Web.config and all my routes are configured with extenionless and extension based equivalents.

I appreciate how easy this configuration must be (sound) for everyone reading who has got it working but I assure you I am not doing anything different and mine will not work. I even tried deploying it on a different server with IIS6 and the same problems happened there too.

Could there be any other reasons why the routing module/handler is completely missing the request and letting it fall through to the standard .NET 404 error? Strange permissions?

For the IIS 404 errors, I updated the custom error setting so it called the Default.aspx page in the route of the site. This is the default page from the MVC beta template generated in visual studio, which does the following in the code behind:

HttpContext.Current.RewritePath(Request.ApplicationPath);
IHttpHandler httpHandler = new MvcHttpHandler();
httpHandler.ProcessRequest(HttpContext.Current);

This just then gives me the error from the previous post:

[HttpException (0x80004005): The incoming request does not match any route.]
   System.Web.Routing.UrlRoutingHandler.ProcessRequest(HttpContextBase httpContext) +15589
   System.Web.Routing.UrlRoutingHandler.ProcessRequest(HttpContext httpContext) +40
   System.Web.Routing.UrlRoutingHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context) +7
   ......

Best Answer

My original problem has been solved by Oli who pointed out that the Global.asax file is needed with the website. I was using NAnt/MSBuild to deploy my release package and the Global.asax file was not included. This file can be ignored in all our .NET 2 projects, and has been with all our NAnt deployment structure, so I didn't spare it a thought.

One to note for the future. Something I didn't spot so all credit to Oli. Thanks again!