For the past 2 weeks I was developing the prototype using Visual Studio 2008 and today the prototype is deployed on one of our IIS 6 Serves running on Window 2003 OS.
When I fired up the browser and accessed the prototype, the home page rendered pretty well. But the rest of the pages are broken – raising 404 errors. Boom!! The prototype is running very well when deployed on IIS 7 or Visual Studio built in web server but not on IIS 6.
Fixing the issue
The cause for the issue is identified as missing configurations in IIS 6 for running MVC and it is fixed by following these simple
1. Open IIS 6 Administrative Console and select the virtual folder of the deployed MVC application
2. Right click on the virtual folder and select Properties; it brings up properties dialog.
3. Make sure you’re on the Virtual Directory tab and select Configuration; it brings up the Application Configuration dialog
4.In the Wildcard application maps section, click the Insert. button; it brings up the wildcard application mapping dialog.
5. Enter the path as “c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll”.
Note: The path of the dll might differ on your machine. One easy way to find out is to look for the .aspx extension in the application extensions list and double click it to get the full path.
6.Uncheck the Verify that file exists checkbox and click the Ok button. Don’t forget to uncheck.
7. Save the changes by clicking on Ok.
8. That’s all. Now the 404 error should disappear.
Side effects
This is a very simple way to fix 404 errors and enable pretty URLs of MVC on IIS 6. But there is a side affect on the performance of the website. By configuring the wild card mapping, we are instructing the web sites to route all the file requests through aspnet_isapi. So even the css, js, jpg, png, etc files will be handled by aspnet_isapi and that will have a considerable impact on the performance of the server.
Is there any better way to fix the issue?
Of course there should be a better way to fix the issue, but I don’t know what is that :) This quick and dirty fix helped me to temporarily set up the prototype site on IIS 6. I’ll research more on this in the coming days and fix the issue in a better way. I’ll share the information with you .
Happy coding!!