Asp.net-mvc – Server 2012 IIS 8 MVC app shows default IIS home page or 403 / 404 errors

asp.net-mvciis-8

Running Microsoft Server 2012 RC using Oracle's free VirtualBox Application. Used a Bridged Network adapter type in the VirtualBox settings. Installed AD and DNS, IIS. Under the IIS options, Management Tools, clicked the box for Management Services. This allowed me to use the "Web Deploy" feature in Visual Studio 2012 RC. On the guest OS, I run Windows 7 Ultimate.

I was able to successfully deploy the MVC 4 Application to IIS Default Web Site, but it wasn't displaying. Instead, the default IIS home page was. I disabled the default home page and refreshing the page displayed a 403 page. I tried typing in one of the Views and a 404 page displayed.

Best Answer

I spent 2 days trying to find a solution to this, and finally did. Wanted to share with the community in case it helps anyone else.

All the articles and forum messages I ran across on the Internet started to mirror each other in one form or another.

One solution talked about making sure you have the right Application Pool configuration, using 4.0 framework and integrated. [x] Confirmed already set correctly.

Another solution extended direction to use "aspnet_regiis -i" or "aspnet_regiis -ir" which doesn't work on Microsoft Server 2012.

Another solution talked about adding the following to the web.config:

<system.webServer>
  <modules runAllManagedModulesForAllRequests="true" />
</system.webServer>

However, IIS 8 serves up a response to this saying something to the effect those settings are locked from a higher configuration level and can't be used at the Application level. Meh, ok.

I ultimately tracked down an article that lead me to the following page: http://learn.iis.net/page.aspx/1097/iis-80-using-aspnet-35-and-aspnet-45

The solution was to go back to the Microsoft Server 2012 Dashboard and select the "Add Roles" feature. Scroll down to the root "Web Server (IIS)", expand "Web Server", expand "Application Development" and select "ASP.NET 3.5" and "ASP.NET 4.5" and "Install".

What confused me originally was I hadn't expanded "Application Development", but selected IIS and continued. On the next step, "Features", ".NET Framework 4.5 Features" was selected by default so I selected ".NET Framework 3.5 Features" and thought all would be fine.

After installing the selections under "Application Development", the MVC 4.5 Applications work just the way they were designed. I hope this helps anyone who may have become stuck, like I was.