如何在ASP.NET中以SQLServer作为sessionState模式处理会话对象超时? [英] How is session object timeout handled in ASP.NET with SQLServer as sessionState mode?
问题描述
在ASP.NET应用程序中将SQL Server设置为状态处理程序时,如何处理会话超时,或者也许在哪里处理会话超时?
How, or maybe where, is the session timeout handled when you set SQL Server as state handler in an ASP.NET application?
.NET框架是谁,在从DB加载会话对象之后,它会判断对象是否已过期,或者是在SQL Server本身上负责此工作的工作?我怀疑(甚至考虑)后一种可能性的原因是,创建ASPState的脚本提到了有关ASPState_Job_DeleteExpiredSessions-element的内容.
Is it the .NET framwork who after loading session objects from the DB does a judgement on whether or not the objects are expired, or is it a job on the SQL Server itself that takes care of this? The reason I suspect (or even concidered) the latter possibility, is that the script that created the ASPState mentioned something about a ASPState_Job_DeleteExpiredSessions-element.
如果是这样,就可以清除它是一个SQL Server作业,那么该作业触发的频率如何,以及如何与web.config中的timeout参数对齐?
If it is so that it is an SQL Server job that cleans up, how often does this job trigger and how does it align with the timeout parameter in web.config?
推荐答案
来自文章由Quantum Elf链接:
From the article linked to by Quantum Elf:
SqlSessionStateStore不会主动监视Expires字段.相反,它依靠外部代理来清理数据库并删除过期的会话(即其Expires字段中保存的日期和时间小于当前日期和时间的会话).ASPState数据库包括一个SQL Server Agent作业,该作业会定期(默认情况下,每60秒一次)调用存储过程DeleteExpiredSessions来删除过期的会话.
这意味着处理过期和会话对象清除的是SQL Server,尤其是SQL Job Agent.
This means that it's the SQL Server that handles expriation and session object purging, and the SQL Job Agent in particular.
这篇关于如何在ASP.NET中以SQLServer作为sessionState模式处理会话对象超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!