简体   繁体   中英

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. Looks like this:

IIS对话框的图片

And in the ASP.NET web.config there is a SessionState setting, looks like this:

<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. The web.config one is for 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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