404 Error when moving ASP.NET MVC application from IIS6 to IIS7

I just got a new development box and I am having trouble getting my MVC project running. My old box had Server 2003 and IIS6. I was able to get my MVC apps working on this field after setting up wildcard mapping as mentioned here . My new window is running Vista Business and IIS7. When I copied the application and tried to run it, I get "http 404 Resource could not be found". mistake. However, if I create a new MVC application and run it, everything is fine. I also copied the Nerd Dinner app from my old box and that works great too.

I have verified that the application is running in Integrated Mode and compares the web.config files with the working and non-working applications, but I cannot see anything different from the application specific applications. I tried to run the app in classic mode with a wildcard set but that doesn't work either. I also tried running the application using Cassini, but got the same results.

+2


source to share


2 answers


Ok, I figured out the problem. This application is a port of a Web Forms application for MVC as a blueprint concept. So, when the project was first created, we just added .MVC to the end of the project name to make it {project name} .MVC. This, unsurprisingly, now that I know what is going on caused a problem with the default routing definitions. I changed the name to use underscore instead of period and everything works now. I assume it worked fine while running under IIS6 as it was configured using wildcard maps and so there was no .MVC extension to confuse it.



0


source


I posted the answer on my blog, check it out at

http://nkitdugar.blogspot.com/2011/02/special-care-while-migrating-mvc.html



I had an MVC based application that was previously hosted in IIS 6. Now IIS 6 does not support extensionless URL routes by default, so we need to add some extension for the controller name in the default route which is defined as {ControllerName} .aspx {Action Method} {Id} in IIS6. Also, if we wanted to go for some other extensions like .mvc, etc., then we needed to match them using methods like character layouts, etc.

Now that we have migrated to IIS7, non-continuation URLs are supported, which means URLs can be there that don't have a corresponding physical location.

So when you port your MVC application to IIS7, make sure there is no type controller defined extension in the Globla.asax default definition route {controller}.aspx\{action method}\{Id}

and change it to \clean URL route {Controller}\{Action Method}\{ID(optional)}

. Second, you have to keep in mind that the AppPool pipeline mode of the website must be set to "Integrated" from the classic.

All of your websites are now ready to be hosted on IIS7.

+1


source







All Articles