SQL Server会话状态的Session_End()替代方案 [英] Session_End() alternatives for SQL Server session state

查看:115
本文介绍了SQL Server会话状态的Session_End()替代方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MVC4中有一个应用程序,该应用程序在Global.aspx.cs中的Session_End()方法中具有一些逻辑.

I have an application in MVC4 which has some logic in the Session_End() method in Global.aspx.cs.

但是,我需要将会话状态从InProc更改为SQLServer,这意味着将不会调用Session_End()方法.

However, I need to change the session state from InProc to SQLServer, and this means the Session_End() method will not get called.

我试图实现

I've tried to effect a workaround but I couldn't get it to work.

Session_End()有哪些替代方案(如果有)?我需要的是能够在会话超时时运行一些逻辑.

What are the alternatives, if any, to Session_End()? All I need is the ability to run some logic when the session times out.

推荐答案

SessionState处于SQLServer模式时,会话不会超时.

The session doesn't time out when SessionState is in SQLServer mode.

会话状态模式:

SQLServer 模式将会话状态存储在SQL Server数据库中.这样可以确保在重新启动Web应用程序后保留会话状态,并使会话状态可用于Web场中的多个Web服务器.

SQLServer mode stores session state in a SQL Server database. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.

这篇关于SQL Server会话状态的Session_End()替代方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆