什么触发了早期会话超时

时间:2022-09-21 15:33:29

I'm creating an ASP.NET MVC 5 application. When the application is left for a few minutes (about 15 minutes), the session times out and I can't access session values anymore.

我创建一个ASP。净MVC应用程序5。当应用程序只剩下几分钟(大约15分钟)时,会话就会超时,我再也不能访问会话值了。

However in my web.config file, I have the following line of code:

然而在我的网页。配置文件,我有以下一行代码:

<sessionState mode="InProc" timeout="30" /> 

So you would expect the session to time out after 30 minutes, sadly that's not happening. If I reduce the session to 5 minutes, then the session times out in 5 minutes, but with a bigger value like 30 minutes, it times out way too early.

所以你会期望会议在30分钟后结束,遗憾的是这并没有发生。如果我将会话缩短为5分钟,那么会话会在5分钟内超时,但是如果有一个更大的值,比如30分钟,那么它会过早地超时。

What events or circumstances could trigger an early session timeout?

哪些事件或情况可能触发早期会话超时?

1 个解决方案

#1


1  

You need to check that both the Server Side and the Client Side have the right timeout value. If your Client Side is set to 30 and your Server-Side is not set to anything, it will default to 20 min (I think 20 min is the timeout). Anything more than this and you may want to look at a different design pattern. If you really need to extend it, then both ends need to be configured with the extended timeout.

您需要检查服务器端和客户端是否都具有正确的超时值。如果您的客户端设置为30,而您的服务器端没有设置为任何内容,那么它将默认为20分钟(我认为20分钟是超时时间)。除此之外,你可能想要看看不同的设计模式。如果您确实需要扩展它,那么需要使用扩展超时配置两端。

#1


1  

You need to check that both the Server Side and the Client Side have the right timeout value. If your Client Side is set to 30 and your Server-Side is not set to anything, it will default to 20 min (I think 20 min is the timeout). Anything more than this and you may want to look at a different design pattern. If you really need to extend it, then both ends need to be configured with the extended timeout.

您需要检查服务器端和客户端是否都具有正确的超时值。如果您的客户端设置为30,而您的服务器端没有设置为任何内容,那么它将默认为20分钟(我认为20分钟是超时时间)。除此之外,你可能想要看看不同的设计模式。如果您确实需要扩展它,那么需要使用扩展超时配置两端。