简体   繁体   English

IIS会话超时与ASP.NET会话超时

[英]IIS Session Timeout vs ASP.NET Session Timeout

In IIS 6 (and other versions too afaik), there is a Session Timeout setting in Properties -> Home Directory Tab -> Configuration button -> Options tab. 在IIS 6(以及其他版本太远)中,属性 - >主目录选项卡 - >配置按钮 - >选项选项卡中有会话超时设置。 Looks like this: 看起来像这样:

IIS对话框的图片

And in the ASP.NET web.config there is a SessionState setting, looks like this: 在ASP.NET web.config中有一个SessionState设置,如下所示:

<system.web>
    <sessionState timeout="120" />
    <!-- etc .. -->
</system.web>

Are they, by any chance, related? 他们是否有任何机会相关? Do they set the same thing, or different things? 他们设置相同的东西,或不同的东西?

They are not the same. 他们不一样。 The IIS session timeout is for clasic ASP pages. IIS会话超时是针对clasic ASP页面。 The web.config one is for asp.net. web.config一个用于asp.net。

据我所知,IIS设置对ASP.NET会话没有影响 - 这些必须在web.config中设置。

You should also consider Application Pool Idle Timeout. 您还应该考虑应用程序池空闲超时。 The settings for the application pool can be found by clicking Properties (IIS 6) or Advanced Settings (IIS 7.5) on the application pool that the application is assigned to. 通过单击应用程序所分配到的应用程序池上的“属性”(IIS 6)或“高级设置”(IIS 7.5),可以找到应用程序池的设置。

Ensure this value is set to the timeout of your session, at a minimum, to ensure that all sessions persist for the entire session timeout period. 确保此值至少设置为会话超时,以确保所有会话在整个会话超时期间保持不变。

The reason that these two values are dependent on one another is because the session information is actually stored within the worker process of the application pool. 这两个值彼此依赖的原因是因为会话信息实际存储在应用程序池的工作进程中。 That is to say, if the worker process is shutdown or killed for any reason, the session information will be lost. 也就是说,如果工作进程因任何原因被关闭或终止,会话信息将丢失。

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

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