简体   繁体   English

IIS 6.0会话超时与Web.Config超时与应用程序池空闲超时

[英]IIS 6.0 Session Timeout Vs Web.Config Timeout Vs App pool Idle time out

I want to increase the session timing of my ASP.NET web App hosted in IIS 6.0. 我想增加IIS 6.0中托管的ASP.NET Web App的会话时间。 So, I changed the SessionState timing to 600 mins in web.config of the site. 因此,我将站点的web.config中的SessionState计时更改为600分钟。 But it didn't work and my session times out like in an hour.( Session["myVariable"] == null ) 但这没有用,我的会话像一个小时后一样超时。( Session["myVariable"] == null

<system.web> 
<sessionState timeout="600" />
  </system.web>

Now I tried setting the Timeout value in IIS website where this application is hosted by going to website -> Properties -> Home Directory Tab -> Configuration button -> Options tab and changin it to 600 mins, still no luck. 现在,我尝试通过转到网站->属性->主目录选项卡->配置按钮->选项选项卡,在承载此应用程序的IIS网站中设置超时值,并将其更改为600分钟,仍然没有运气。 The question here says that this is for classic ASP Pages but not for ASP.NET web sites. 这里的问题是,这适用于经典的ASP Pages,而不适用于ASP.NET网站。 which means that I am doing it wrong. 这表示我做错了。

Then I checked the app pool under which this application runs (app Pool->Properties-->Performance tab). 然后,我检查了运行该应用程序的应用程序池(“应用程序池”->“属性”->“性能”选项卡)。 This says "Recycle Worker Process(in minutes)" as 10 mins. 这表示“回收工人流程(以分钟为单位)”为10分钟。 I read many questions on SO but none of them gives a clear cut answer on how to increase the session timeout on ASP.NET WebApp. 我阅读了很多关于SO的问题,但是没有一个问题给出了有关如何增加ASP.NET WebApp会话超时的明确答案。

I want to know the difference between these three settings and when to use which and how do we increase the session timeout of my webApp. 我想知道这三个设置之间的区别,以及何时使用哪些设置以及如何增加WebApp的会话超时。

The timeout you set in your web.config is the session timeout. 您在web.config中设置的超时是会话超时。 It controls how long each 'session' of your web app needs to wait before expiration. 它控制Web应用程序的每个“会话”在到期前需要等待的时间。 Let's say one user logs in to your app and does nothing for 20 minutes and then clicks a button, he will be logged out and needs to login again (assume session timeout is 20 mins). 假设有一个用户登录到您的应用程序,并且在20分钟内未执行任何操作,然后单击一个按钮,那么该用户将被注销,需要再次登录(假设会话超时为20分钟)。 Any other users who were continuing their work won't be affected. 继续工作的任何其他用户都不会受到影响。

App pool recycling is a different thing. 应用程序池回收是另一回事。 It's a setting which kills and restarts the worker process in IIS as instructed. 此设置可按照指​​示终止并重新启动IIS中的工作进程。 So if you have it set for 10 minutes, it's like you are restarting IIS every 10 minutes. 因此,如果将其设置为10分钟,就好像您每10分钟重新启动IIS。 So all sessions in apps which uses that app pool will get expired unless you have sessions state saved elsewhere. 因此,除非您将会话状态保存在其他位置,否则使用该应用程序池的应用程序中的所有会话都将过期。

There is another setting in app pool, which is the idle timeout. 应用程序池中还有另一个设置,即空闲超时。 It's also set in minutes and it also terminates the worker process if there are no requests for that time period. 它还设置为分钟,如果在该时间段内没有请求,它也会终止工作进程。 If you have only your app running in IIS, then you should increase this value as well, along with your session timeout value in web.config. 如果只有您的应用程序在IIS中运行,则还应该增加此值以及web.config中的会话超时值。 Otherwise even though ASP.NET likes to keep its sessions for long, the app pool won't. 否则,即使ASP.NET喜欢长时间保持其会话,应用程序池也不会保留。

This setting is found in app pool -> advanced settings -> process model 可在应用程序池->高级设置->流程模型中找到此设置

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

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