开发者

How can I track the reason why an ASP.NET Session times out?

I'm trying to track down an issue on an ASP.NET v3.5 application where the HttpSession times out before its (default) 20 minute开发者_运维知识库s. We're seeing behaviour where the session is lost only a few minutes into a session, at random and with no discernible cause such as unhandled exceptions. As far as I can tell, the ASP.NET worker process is not dying, otherwise that would have explained the dropped session.

What approach should I use to monitor when the session is dropped? Is there some event I can listen to, or some other hook in the System.Web namespace?

Also, can someone confirm that the countdown to expiration is reset by web activity? That is, the session's lifetime gets reset to the (default) 20 minutes each time the web client makes an HTTP GET or POST?


There is an Session_OnEnd event you can use.


Have you checked the limits configured for the IIS. There are a few of them to limit CPU, Network usage etc. If this happens it will write all the logging to the Event Log if closing a session.

And on your second question the countdown timer for a session in IIS is rested at every request.

Update: Check this one out.. http://bluedragon.blog-city.com/lost_sessions_webgardens_sessionstate.htm

Talking about setting the max number of processes to higher than 1.

Cheers, Stefan

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜