I recently built a new ASP.NET MVC 3 (.NET 4) web application which unfortunately has be hosted on Windows Server 2003 running IIS 6. Guess I’d figured getting it running on IIS 6 would be as easy as installing .NET 4 and ASP.NET MVC 3 on the server… but it wasn’t. This isn’t a step by step tutorial on how to get this working, but more of a list of things to look out for and some links to helpful material which all helped getting my site up and running.
- Install the .NET 4 Framework.
- Install ASP.NET MVC 3. Apparently you can avoid installing ASP.NET MVC 3 on the server and just deploy all the appropriate MVC assemblies in the bin folder of your app instead, but I couldn’t get this to work.
- Make sure ASP.NET v4.0.30319 is ‘Allowed’ under Web Service Extensions in IIS – it is ‘Prohibited’ by default.
- Create a new app pool for your web site to use – IIS 6 app pools cannot run sites under different frameworks so make sure this app pool is only used for your new site.
IIS Website Configuration
Right click on your new website and select ‘Properties’:
- Under the ‘ASP.NET’ tab, make sure that the ASP.NET version is set to ‘4.0.30319’.
- Under the ‘Home Directory’ tab, make sure that ‘Execute permissions’ is set to ‘Scripts only’ (at least).
- Click on the ‘Configuration’ button in the ‘Home Directory’ tab and make sure that all the Application extensions are mapped to .NET 4 versions of the dlls.
- Add a ‘Wildcard application mapping’ – click on ‘Insert’ and enter ‘C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll’ as the ‘Executable’. Leave ‘Verify that file exists’ unchecked – checking this made my routes stop working.
If you’re running under an account with limited permissions, you may need to grant it ‘List Folder Contents’ and ‘Read’ permissions on the Windows Temp directory. I needed to do this because I’m calling out to web services and .NET creates temporary classes in the Windows Temp directory with which to serialize objects from XML. Not sure if this is needed if you’re not doing any serializations, but worth mentioning.
I kept getting 403 and 404 errors when I first deployed my new ASP.NET MVC 3 (.NET 4) web application to IIS 6, but after doing / checking all of the above, it all seems to be working smoothly.
And last but not least: if you’re allowed to, try recycling your application pool and resetting IIS if some changes don’t seem to be making much difference.