如何设置IIS以使应用程序保持活动状态?

时间:2023-01-24 17:49:30

I think my Webapplication gets shut down after a while.

我想我的Web应用程序会在一段时间后关闭。

It returns a new session if I haven't used the application in maybe 5 minutes. The session timeout is set to 720 minutes so that can't be the issue.

如果我在5分钟内没有使用该应用程序,它将返回一个新会话。会话超时设置为720分钟,因此不会出现问题。

Is it maybe a setting in the Application Pool or something like that? I figure it is some sort of resource management. I use IIS 7.0

它可能是应用程序池中的设置还是类似的东西?我认为这是某种资源管理。我使用IIS 7.0

I am a dork with servers so please bear with me if I am missing the obvious here.

我是一个带服务器的笨蛋,所以如果我在这里错过了明显的话,请耐心等待。

6 个解决方案

#1


We had the same issue with a web service that had to stay online in such a way that we couldn't afford the latency involved in starting it up if it went stale.

我们遇到了同样的问题,一个Web服务必须以这样的方式保持在线状态,即如果它变得陈旧,我们就无法承担启动它所涉及的延迟。

We wrote a very simple Windows Service that woke up every 3 minutes and requested a page as @Wayne suggested. Worked like a charm.

我们写了一个非常简单的Windows服务,每隔3分钟醒来一次,并按照@Wayne的建议请求一个页面。工作就像一个魅力。

#2


IIS has a feature in properties where you can stop recycle your IIS on intervals

IIS在属性中具有一项功能,您可以按时间间隔停止回收IIS

  1. Go to your "IIS Manager"
  2. 转到“IIS管理器”

  3. Select "Application Pool" the instance you want to manage.
  4. 选择要管理的实例的“应用程序池”。

  5. Select "Advanced settings" action
  6. 选择“高级设置”操作

  7. Under "Recycling" and set "Regular Time Interval" to 0, which means the application pool does not recycle.
  8. 在“回收”下,将“常规时间间隔”设置为0,表示应用程序池不回收。

#3


  1. Open "IIS Manager"
  2. 打开“IIS管理器”

  3. Select "Application Pool" the instance you want to manage
  4. 选择要管理的实例的“应用程序池”

  5. Select "Advanced settings"
  6. 选择“高级设置”

  7. Under "(General)" and set "Start Mode" to "AlwaysRunning", which means the application pool keep the ASP.NET application run always
  8. 在“(常规)”下并将“启动模式”设置为“AlwaysRunning”,这意味着应用程序池始终保持ASP.NET应用程序运行

PS. If you want the ASP.NET application be loaded automatically, you can follow this:

PS。如果要自动加载ASP.NET应用程序,可以按照以下步骤操作:

  1. Open "IIS Manager"
  2. 打开“IIS管理器”

  3. Select the application you want to manage
  4. 选择要管理的应用程序

  5. Select "Advanced settings"
  6. 选择“高级设置”

  7. Under "(General)" and set "Preload Enabled" to "true", which means the applicaton will be loaded automatically after its deployment.
  8. 在“(常规)”下,将“Preload Enabled”设置为“true”,这意味着应用程序将在部署后自动加载。

For more information, please visit this:Use IIS Application Initialization for keeping ASP.NET Apps alive

有关详细信息,请访问:使用IIS应用程序初始化来保持ASP.NET应用程序的活动

#4


The simplest way is to use a script to open a connection to the website and request your page. See Joel Oleson's Blog for more information.

最简单的方法是使用脚本打开与网站的连接并请求您的页面。有关更多信息,请参阅Joel Oleson的博客。

You can use windows scheduler to run every x minutes.

您可以使用Windows调度程序每隔x分钟运行一次。

This maybe Sharepoint specific but you can adapt to your requirements.

这可能是Sharepoint特定的,但您可以适应您的要求。

Update: Try this version: WarmUpServer.zip

更新:试试这个版本:WarmUpServer.zip

#5


Application pools do recycle, and they do restart after achieving some limits in terms of execution time or number of requests etc, that can be set on IIS.

应用程序池会进行回收,并且在执行时间或请求数量等方面达到某些限制后会重新启动,这些限制可以在IIS上设置。

IIS 7 actually runs in pipeline mode so its something new which we dont know yet for sure, but all you can do to make your app alive is to set a trigger from some other machine which will connect your server in every 5 or 10 or 60 minutes and try to fetch one html page.

IIS 7实际上是以管道模式运行的,所以我们还不知道它的新内容,但你可以做的就是让你的应用程序保持活力状态是从其他机器设置一个触发器,它将每隔5或10或60连接你的服务器分钟,并尝试获取一个HTML页面。

There can be various server monitors for http as well.

http也可以有各种服务器监视器。

#6


After failed at configuring IIS pool. I come out with this simple windows service. github code

配置IIS池失败后。我推出了这个简单的Windows服务。 github代码

It can save some minutes of you.

它可以节省你几分钟。

#1


We had the same issue with a web service that had to stay online in such a way that we couldn't afford the latency involved in starting it up if it went stale.

我们遇到了同样的问题,一个Web服务必须以这样的方式保持在线状态,即如果它变得陈旧,我们就无法承担启动它所涉及的延迟。

We wrote a very simple Windows Service that woke up every 3 minutes and requested a page as @Wayne suggested. Worked like a charm.

我们写了一个非常简单的Windows服务,每隔3分钟醒来一次,并按照@Wayne的建议请求一个页面。工作就像一个魅力。

#2


IIS has a feature in properties where you can stop recycle your IIS on intervals

IIS在属性中具有一项功能,您可以按时间间隔停止回收IIS

  1. Go to your "IIS Manager"
  2. 转到“IIS管理器”

  3. Select "Application Pool" the instance you want to manage.
  4. 选择要管理的实例的“应用程序池”。

  5. Select "Advanced settings" action
  6. 选择“高级设置”操作

  7. Under "Recycling" and set "Regular Time Interval" to 0, which means the application pool does not recycle.
  8. 在“回收”下,将“常规时间间隔”设置为0,表示应用程序池不回收。

#3


  1. Open "IIS Manager"
  2. 打开“IIS管理器”

  3. Select "Application Pool" the instance you want to manage
  4. 选择要管理的实例的“应用程序池”

  5. Select "Advanced settings"
  6. 选择“高级设置”

  7. Under "(General)" and set "Start Mode" to "AlwaysRunning", which means the application pool keep the ASP.NET application run always
  8. 在“(常规)”下并将“启动模式”设置为“AlwaysRunning”,这意味着应用程序池始终保持ASP.NET应用程序运行

PS. If you want the ASP.NET application be loaded automatically, you can follow this:

PS。如果要自动加载ASP.NET应用程序,可以按照以下步骤操作:

  1. Open "IIS Manager"
  2. 打开“IIS管理器”

  3. Select the application you want to manage
  4. 选择要管理的应用程序

  5. Select "Advanced settings"
  6. 选择“高级设置”

  7. Under "(General)" and set "Preload Enabled" to "true", which means the applicaton will be loaded automatically after its deployment.
  8. 在“(常规)”下,将“Preload Enabled”设置为“true”,这意味着应用程序将在部署后自动加载。

For more information, please visit this:Use IIS Application Initialization for keeping ASP.NET Apps alive

有关详细信息,请访问:使用IIS应用程序初始化来保持ASP.NET应用程序的活动

#4


The simplest way is to use a script to open a connection to the website and request your page. See Joel Oleson's Blog for more information.

最简单的方法是使用脚本打开与网站的连接并请求您的页面。有关更多信息,请参阅Joel Oleson的博客。

You can use windows scheduler to run every x minutes.

您可以使用Windows调度程序每隔x分钟运行一次。

This maybe Sharepoint specific but you can adapt to your requirements.

这可能是Sharepoint特定的,但您可以适应您的要求。

Update: Try this version: WarmUpServer.zip

更新:试试这个版本:WarmUpServer.zip

#5


Application pools do recycle, and they do restart after achieving some limits in terms of execution time or number of requests etc, that can be set on IIS.

应用程序池会进行回收,并且在执行时间或请求数量等方面达到某些限制后会重新启动,这些限制可以在IIS上设置。

IIS 7 actually runs in pipeline mode so its something new which we dont know yet for sure, but all you can do to make your app alive is to set a trigger from some other machine which will connect your server in every 5 or 10 or 60 minutes and try to fetch one html page.

IIS 7实际上是以管道模式运行的,所以我们还不知道它的新内容,但你可以做的就是让你的应用程序保持活力状态是从其他机器设置一个触发器,它将每隔5或10或60连接你的服务器分钟,并尝试获取一个HTML页面。

There can be various server monitors for http as well.

http也可以有各种服务器监视器。

#6


After failed at configuring IIS pool. I come out with this simple windows service. github code

配置IIS池失败后。我推出了这个简单的Windows服务。 github代码

It can save some minutes of you.

它可以节省你几分钟。