Wednesday, September 21, 2011

I was testing my MVC2 application on a new IIS server setup by my colleague.  However, when I tried to run it, I got error said it can't locate the file.  Then I poked around the server to see if there were any setting mistakes.  When I hit the .NET Compilation option on the Site settings, I got an error.  After a bit of research on Google, it seems this problem was caused by the order of installation.

It seems if IIS server was installed after the .NET installation, the IIS will not pick up the necessary changes made by .NET Framework installer to run the MVC2.  To fix it, you can run the aspnet_regiis tool within the .NET folder (located in %windir%\Microsoft.NET\Framework\v4.0.30319) with the iru option as suggested in Scott Hanselman's blog http://www.hanselman.com/blog/ASPNET4BreakingChangesAndStuffToBeAwareOf.aspx.

In Scott's blog, he suggests to enter the command as

aspnet_regiis -iru

However, on my Windows Server 2008 (NOT R2), I found the -iru didn't work, but /iru works, e.g. aspnet_regiis /iru.  Therefore, I would suggest you to try using /iru if -iru did not work for you.

Further references can be found at: http://msdn.microsoft.com/en-us/library/k6h9cz8h%28v=VS.100%29.aspx

No comments: