Request is not available in this context

部署到新服务器的IIS的时候发现这个错误:

 Request is not available in this context

解决方案:

<system.web>
 <customErrors mode="Off" />

        <authentication mode="Forms">
            <forms loginUrl="~/home" timeout="30" slidingExpiration="true" />
        </authentication>
        <pages asyncTimeout="60" />
        <compilation targetFramework="4.5" />
        <httpRuntime targetFramework="4.5" maxRequestLength="2097151" executionTimeout="6000" />
        <sessionState mode="StateServer" timeout="120" cookieless="false" />
        <globalization requestEncoding="utf-8" responseEncoding="utf-8" fileEncoding="utf-8" culture="zh-cn" />
    </system.web>

web.config这里配置下,请参考红色的部分!

原文地址:https://www.cnblogs.com/flyfish2012/p/5673231.html