加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 为什么设置为SqlServer时会话超时不起作用?

发布时间:2020-12-16 03:33:19 所属栏目:asp.Net 来源:网络整理
导读:我有这条线: sessionState mode="SQLServer" sqlConnectionString="Data Source=localhost;User Id=sa;Password=test;" timeout="1" / 它将会话存储在sql状态服务器中.但是一分钟后它没有正常超时. 当我更改线以使用InProc模式时: sessionState mode="InPr
我有这条线:

<sessionState mode="SQLServer" sqlConnectionString="Data Source=localhost;User Id=sa;Password=test;" timeout="1" />

它将会话存储在sql状态服务器中.但是一分钟后它没有正常超时.

当我更改线以使用InProc模式时:

<sessionState mode="InProc" sqlConnectionString="Data Source=localhost;User Id=sa;Password=test;" timeout="1" />

一分钟后它会超时.

任何想法为什么会这样?使用SqlServer时如何让它超时?

解决方法

如果您使用的是SQL Server Express,那是因为没有SQL Server代理来执行DeleteExpiredSessions过程.

以下是该问题的可能解决方法:

In the stored procedure that updates the session,I have added SQL from the DeleteExpiredSessions procedure to the update session stored procedure (I can’t remember the name) so it checks for old sessions,deletes the old session,and then updates the current sessions. The stored procedure that updates the session runs on every click anyway,so I added two more lines that remove old sessions before the session is updated. This seems to work fine.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读