C# Web网站
有时候在web.config设置sessionState 或者类文件里设置Session.Timeout,在IIS里访问时每次都是达不到时间就超时,原因是因为在IIS中设置了Session的超时时间,IIS里设置Session方法为:
在IIS里面右键点击默认网站->主目录->应用程序设置里点配置->选项->启用会话状态->会话超时那里设置时间
再web.config中设置Session过期时间方法:
<system.web> <!--最大请求长度,单位为kb--> <compilation debug="true" targetFramework="4.6" /> <httpRuntime targetFramework="4.6" maxRequestLength="409600" /> <httpModules> <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" /> </httpModules> <!--<sessionState mode="InProc" timeout="20" />--> </system.web>
timeout 设置经过多少分钟后服务器自动放弃Session信息。默认为20分钟