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

做一个ASP.NET网站的更改杀死活动会话?

发布时间:2020-12-15 18:59:12 所属栏目:asp.Net 来源:网络整理
导读:我担心我的用户会话被扫除的可能性.我正在使用默认的ASP.NET Session对象和会话cookie.我知道会话可以超时,我已经将会话的超时值设置为几个小时,以避免超时. 但至少还有另外两个我担心的情况. (1)我了解ASP.NET定期回收运行网站/网络应用程序的应用程序域(不
我担心我的用户会话被扫除的可能性.我正在使用默认的ASP.NET Session对象和会话cookie.我知道会话可以超时,我已经将会话的超时值设置为几个小时,以避免超时.

但至少还有另外两个我担心的情况.

(1)我了解ASP.NET定期回收运行网站/网络应用程序的应用程序域(不知道我是否在这里使用所有术语).这些回收事件是否会进行会话?

(2)至少在我的开发服务器上,对网站进行的某些更改(例如,添加新页面)似乎会导致活动会话在重新编译网站(或其一部分)时丢失.这似乎并没有发生在每一个变化,但很多它做.我特别关心这是什么意思,在我的网站生活的可能性的变化.我想知道我可以更新的规则,而不会导致活动会话被杀死.

感谢任何指针.

解决方法

这取决于你的会话状态模式.这里有一个你可以在 Microsoft Support找到的东西的副本:

ASP.NET supports three modes of
session state:

  • InProc: In-Proc mode stores values in the memory of the ASP.NET
    worker process. Thus,this mode offers
    the fastest access to these values.
    However,when the ASP.NET worker
    process recycles,the state data is
    lost.
  • StateServer: Alternately,StateServer mode uses a stand-alone
    Microsoft Windows service to store
    session variables. Because this
    service is independent of Microsoft
    Internet Information Server (IIS),it
    can run on a separate server. You can
    use this mode for a load-balancing
    solution because multiple Web servers
    can share session variables. Although
    session variables are not lost if you
    restart IIS,performance is impacted
    when you cross process boundaries.
  • SqlServer: If you are greatly concerned about the persistence of
    session information,you can use
    SqlServer mode to leverage Microsoft
    SQL Server to ensure the highest level
    of reliability. SqlServer mode is
    similar to out-of-process mode,except
    that the session data is maintained in
    a SQL Server. SqlServer mode also
    enables you to utilize a state store
    that is located out of the IIS process
    and that can be located on the local
    computer or a remote server.

如果您使用StateServer或数据库,当IIS检测到网站的更改时,会话数据将不会丢失.

(编辑:李大同)

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

    推荐文章
      热点阅读