Dominic St-Pierre Dominic St-Pierre - 1 year ago 202
ASP.NET (C#) Question

ASP.NET 4.5 MVC 4 not working on Windows Server 2008 IIS 7

Clearly I'm missing something, I'm unable to deploy a simple ASP.NET MVC 4, .NET 4.5 app on a Windows Small Business Server 2008 on IIS 7.

.NET framework 4.5 is installed.

Should I be supposed to see that version (4.5) on the Application Pool basic settings of the application? At this time, I only have 2.0 and 4.0, since 4.5 is like the 3.5 which only add on top of the 4.0 framework, I guess this is normal.

When I browse the home page, I got the following error:

403 - Forbidden: Access is denied.
You do not have permission to view this directory or page using the credentials that you supplied.

When I request the only controller named Page /page/index I get the 404 not found page. Like the ASP.NET process never get the http request.

I can request a simple HTML page.

The Application Pool is set to .NET 4.0 and Integrated as the Managed pipeline mode.

NETWORK SERVICE has read/write access to the directory.

The app work flawlessly from VS2012 of course.

I'm clueless on what's not right here, and search engine queries are not helping much.

Does anyone would have a hint, that would be extremely appreciated.


The dlls are already on the bin folder like System.Web.Mvc, System.Web.Razor etc.

I created a empty test.aspx page to make sure worker process was getting the request, and yes the page was OK. So it appears that the MVC routing is not working, though I have ASP.NET MVC 3 web app working fine on that server.

After the .NET 4.5 installation I did a aspnet_regiis -iru in case, that added an aspnet_client folder on the app, but still this does not fix the issue.

Anonymous Authentication is Enable on IIS Authentication section, and Authorization show allow for all users.

ASP.NET MVC 4 is installed, I just did a repair to make sure.

Eventhough the ASP.NET MVC 4 is installed, the 404 error from requesting the /page/index action is returned by the standard IIS and not the standard aspnet error. So indeed it appears like the MVC 4 framework is not properly installed, by I just double check and do a repair. Where can I continue to investigate?

@Mystere Man, I've changed the Anonymous Authentication to use the Application Pool identity, stop, start the app and still the same error. It really look like if ASP.NET MVC 4 is not taking the request.

Here is a part of the web.config:

<validation validateIntegratedModeConfiguration="false" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="" newVersion="" />
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="" newVersion="" />
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="" newVersion="" />
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />

Edit 2012/09/27

I've re-pair Microsoft Framework .NET 4.5 and repair the ASP.NET MVC 4, re-deploy the simple ASP.NET MVC 4 app, and I still get the same behaviour. I'm not sure what to do next, so I started a bounty in the hope that someone could help me find the problem.

Edit 2014/01/31

When I asked that question, I flagged the runAllManagedModulesForAllRequests as the accepted answer because it did solve the problem. But I was certainly not going to use this in production. I ask why I had to do this and did not have any answers.

Than Martin Hollingsworth answer was really what I was looking for, a good way to fix this problem without all the performance issues related to the runAllManagedModulesForAllRequests.

We almost gave up and bought a new Windows 2012 server (from which the ASP.NET MVC app work as is). After trying Martin's solution, the Windows 2008 server worked.

Answer Source

If you are not able to apply the QFE from kb 980368, instead of using the runAllManagedModulesForAllRequests solution as suggested in the accepted answer, you should use the modules configuration with preCondition="" shown below to avoid the negative impact on static content as described in the blog posts How asp.NET MVC Routing Works and its Impact on the Performance of Static Requests and Don't use runAllManagedModulesForAllRequests="true" when getting your MVC routing to work and some of the comments on the answers.

Scott Hanselman's blog post about runAllManagedModulesForAllRequests should add some weight to this argument. Rick Strahl's post Caveats with the runAllManagedModulesForAllRequests in IIS 7/8 is the best explanation of the interaction between the settings I have found. The IIS documentation on the module preCondition attribute is also worth a read.

Remember this configuration change is not necessary if you have applied the QFE as this behaviour becomes the default.

    <remove name="UrlRoutingModule-4.0" />
    <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download