Troubleshooting ASP.NET MVC on IIS 7

Some days ago we had to work hard on this topic to make an ASP.NET MVC application run on IIS7. It took us almost 2 hours, and after completing the task I decided it deserves a post.

I will start by listing the common setup steps and then I will share our particular case.

Solving common issues

First of all you need to have IIS installed and ASP.NET registered, this seems obvious but it must be mentioned. If you installed .NET framework after installing IIS then .NET Framework installation takes care of registering ASP.NET in IIS. But if you installed IIS after installing .NET, then you will have to make the registration yourself. To do this open a Command Prompt (running as administrator), go to the .NET framework folder (typically WindowsMicrosoft.NETFrameworkvXXXX) and execute the command aspnet_regiis –i.


Once you have IIS with ASP.NET running, you can create the website or virtual directory for your application, point it to your application folder  and if you are lucky your application is now running.

One common issue you can find is that when trying to browse your application you get a blank page, no errors, just a blank page. This usually happens when the IIS HTTP Redirection component is missing. So to fix it, just install this component by browsing Control Panel | Programs | Turn Windows features on or off | Internet Information Services | Word Wide Web Services | Common HTTP features and check HTTP Redirection.


Solving our particular case (when you have two different ASP.NET builds installed)

In our case, we had the problem that the machine had installed 2 different builds of ASP.NET v4 (I think these builds corresponded to beta 1 and beta2 versions). After we followed the previous steps, when trying to run the application the app pool try to load the incorrect version (beta 1), it failed and the app pool stopped. We tried  to  re-register ASP.NET, but it didn’t work. In the APP Pool configuration we explicitly set the correct version, but at runtime, it tried to load the incorrect one. How did we solved it:

  • Un-register ALL ASP.NET versions (by running aspnet_regiis –ua).
  • Delete Beta 1 folder located under WindowsMicrosoft.NETFramework.
  • Register again the ASP.NET beta 2 version. (by running aspnet_regiis –i)

That was all, hope this help you.