ASP.MVC Session为null
ASP.NET MVC应用本地开发测试正常,然而,发布到测试服务器上没法正常登录,日志跟踪发现Session为null
快速解决办法
<configuration>
...
<system.webServer>
...
<modules>
<remove name="Session" />
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
...
</modules>
</system.webServer>
</configuration>
参考:https://stackoverflow.com/questions/218057/httpcontext-current-session-is-null-when-routing-requests