简体   繁体   English

在asp.net中处理sessionstate

[英]handling sessionstate in asp.net

I have the following session state entry in web.config on one of the applications I need to debug on random logouts 我需要在随机注销中调试的应用程序之一上的web.config中具有以下会话状态条目

<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20"/>

I have checked on the webserver, win 2003, Asp.net state service is not running and also no instance of sql server is running. 我已经在网络服务器上检查了,赢了2003,Asp.net状态服务未运行,并且没有sql server实例正在运行。

what would the session timeout according to this entry in web.config. 根据web.config中的此项,会话超时将是多少? 20min? 20分钟? Do we must have the Asp.net state service running for using stateConnectionString? 为了使用stateConnectionString,我们是否必须运行Asp.net状态服务?

You have set the mode attribute to InProc , which means that the session will be stored inside the IIS worker process. 您已将mode属性设置为InProc ,这意味着该会话将存储在IIS工作进程中。 That means that the stateConnectionString and sqlConnectionString are probably ignored. 这意味着stateConnectionStringsqlConnectionString可能会被忽略。

If you would like to use the other modes you should change the InProc to StateServer or SQLServer respectively. 如果要使用其他模式,则应将InProc分别更改为StateServerSQLServer More details here . 更多细节在这里

With InProc the session should still be stored for 20 minutes, but If your worker process recycles, which by default happens every 29 hours, it will lose all the sessions, so you probably want to be using the StateServer (ASP.NET State Service should be started), or another more persistent option for the task of managing logged in users. 使用InProc,会话仍应存储20分钟,但是如果您的工作进程回收(默认情况下每29小时进行一次回收),它将丢失所有会话,因此您可能希望使用StateServer (ASP.NET状态服务应(开始)),或用于管理已登录用户的任务的另一个更持久的选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM