Rectangle 27 0

iis 7 The Session object is null in ASP.NET MVC 4 webapplication once deployed to IIS 7 (W 2008 R2)?


<configuration>
  ...
  <system.webServer>
    ...
    <modules>
      <remove name="Session" />
      <add name="Session" type="System.Web.SessionState.SessionStateModule"/>
      ...
    </modules>
  </system.webServer>
</configuration>

I found the solution. You have to add and remove the SessionStateModule:

I have no idea why Microsoft doesn't add this to the web.config of the project template?

Never saw this need to remove and add. Might be some particularity of MVC4 + IIS7... It worked for me! +1

Note
Rectangle 27 0

iis 7 The Session object is null in ASP.NET MVC 4 webapplication once deployed to IIS 7 (W 2008 R2)?


<configuration>
  ...
  <system.webServer>
    ...
    <modules>
      <remove name="Session" />
      <add name="Session" type="System.Web.SessionState.SessionStateModule"/>
      ...
    </modules>
  </system.webServer>
</configuration>

I found the solution. You have to add and remove the SessionStateModule:

I have no idea why Microsoft doesn't add this to the web.config of the project template?

Never saw this need to remove and add. Might be some particularity of MVC4 + IIS7... It worked for me! +1

Note