views:

2030

answers:

6

Hi,

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
   ......
A: 

check out this blog

http://blog.codeville.net/2008/07/04/options-for-deploying-aspnet-mvc-to-iis-6/

Arief Iman Santoso
Thanks but I have read and done all that and I still just get the .NET 404 page.
Tim Peel
A: 

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

Whats the order of the extension and extensionless routes?

I would either remove extensionless (since you are using extensions), or make sure it is added after extension routes (due to the first match nature of routing).

Also, check out http://www.asp.net/learn/mvc/tutorial-08-cs.aspx and simply double check you have IIS setup right (it sounds like you do).

eyston
A: 

Thanks huey, been through that post too - everything configured the same.

My extensionless routes are output before the extension ones, purely because I intend to use an ISAPI rewrite module and want any URLs generated from my route table to be clean. They will then be re-written to the extenion based ones.

I don't even care about extensionless URLs though at the moment, would just like to get a version working so I can show the client! I've really enjoyed the MVC stuff up to now but this has taken the shine off things.

Thanks again for your assistance.

Tim Peel
With my setup, routing fails if I have both extension and extensionless configured with extensionsless declared first. I assume the routing engine is matching that initially, and then IIS is given non-extension based urls. I would remove extensionless and try it out just to see.
eyston
+1  A: 

Try starting with the simplest configuration possible. Change your Route definitions to use .aspx instead of .mvc and see if /home.aspx/index works or not.

Haacked
This is the right answer. I got this to work last night on CrystalTech. If a better answer isn't posted by the time I get home I'll post with my routes. Make sure your default route is using the .aspx on the controller as well.
Terry Donaghe
Answer posted - was not including Global.asax - sounds simple now but I presumed the configuration would be compiled into the application without needing the stub file.
Tim Peel
+2  A: 

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!

Tim Peel
A: 

Url rewriting can help you to solve the problem. I've implemented solution allowing to deploy MVC application at any IIS version even when virtual hosting is used. http://www.codeproject.com/KB/aspnet/iis-aspnet-url-rewriting.aspx

Alex Ilyin