Thursday, 2 November 2017

MVC 5 Not working in IIS 7


It’s a common problem when MVC application is not working in IIS but working good with IIS Express.

This is happening as you have installed IIS after Visual studio and due to this reason ASP.net is not registered with IIS.

You just need to register your ASP.net   like below.

Register ASP.NET

64 bit system
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis –i

32 bit system
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis –i


Add below tag  in Web.config

Once you register don’t forget update your web.config file with below tag

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

Currently my web.config is look a like below. As in System.webserver is already having some context.
<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="ApplicationInsightsWebTracking" />
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
    </modules>

  </system.webServer>

No comments:

Post a Comment