Deployed ASP.NET MVC app gives 404 on About Page
I am working through learning how to use the ASP.NET MVC framework with a web application. One of the annoying problems that I recently hit on was that the sample worked great when running under Cassini in the development environment but when deployed to IIS 6 I couldn't get to the About or Home page through the URL paths.
The following comment exists in the Global.asax.cs file:
// Note: Change the URL to "{controller}.mvc/{action}/{id}" to enable
// automatic support on IIS6 and IIS7 classic mode
When running in Cassini you don't need to make this change. However, under IIS 6, if you forget to make this change then you'll hit this problem and get 404 page-not-found errors. Simply making this change appears to solve the problem.
I read some comments on the web that you need to add .mvc as a MIME type with a mapping of C:\WINDOWS\MICROSOFT.NET\FRAMEWORK\V2.0.50727\ASPNET_ISAPI.DLL which I tried initially with no success and then later went back and removed it when I got it working with the above solution. The MIME types don't appear to be the solution.
This was done with the MVC preview 2 released in Dec 2008.
Addendum:
I found that on Server 2003 Enterprise (Dev Machine) I did not need to map .mvc to C:\WINDOWS\MICROSOFT.NET\FRAMEWORK\V2.0.50727\ASPNET_ISAPI.DLL but when I deployed to Production (Server 2003 Standard) I had to go into the web site's properties and click Home Directory (tab) and then Configuration... (button) and then add the mapping. I thought that this was an Enterprise/Standard thing but then on closer inspection I discovered that the Enterprise machine already had this mapping. This probably happened when I installed the MVC preview onto the Enterprise (Dev) machine and it looks like (contrary to what I said before) you do need this mapping.
Addendum 2: (27 Oct 2008):
Since I've upgraded to asp.net mvc beta I've found that the above fixes don't work for me - they may still work for you. I've found the following resources useful so far:
Deploying ASP.NET MVC to IIS 6
Using ASP.NET MVC on IIS without the .MVC extension