ASP.NET SessionState timeout

六眼飞鱼酱① 提交于 2019-12-24 09:26:29

问题


I use ASP.NET website on IIS7 where in web.config I have:

<sessionState mode="InProc" timeout="20"></sessionState>

But session doesn't keep 20 minutes, it works very strange, sometimes it expires in 1 minute or less, sometimes just redirect to other page. I need use mode="InProc".

Who can help me, what is wrong and how to resolve this problem? Thanks!


回答1:


If you have an application that is throwing unhandled exceptions, the application could recycle. Or, it could recycle because of memory pressure or even just from the wrong settings in IIS. This would cause you to lose session. You can put some logging code in the Application_End Eventhandler in global.asax to check for this condition.




回答2:


Maybe this article be useful for you:

http://www.hanselman.com/blog/TroubleshootingExpiredASPNETSessionStateAndYourOptions.aspx




回答3:


Application Pool Recycling? (IIS setting).

Anyway, you can detect and handle the timeout in the global.asax (session_end), if that helps.



来源:https://stackoverflow.com/questions/6795112/asp-net-sessionstate-timeout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!