你可以prevent从关闭ASP.NET应用程序? [英] Can you prevent your ASP.NET application from shutting down?

查看:109
本文介绍了你可以prevent从关闭ASP.NET应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我听说ASP.NET应用程序会同时在空闲(即没有观众)后关闭。

I think I heard that ASP.NET applications will shut down after a while of being idle (i.e. no visitors).

有没有办法来prevent的发生这种行为?我有一个运行在的global.asax.cs一些code Application_Start事件定时器,并希望确保它继续运行,即使没有游客击中的部位。

Is there a way to prevent this behavior from happening? I have a timer that runs some code from the global.asax.cs application_start event, and want to make sure that it continues to run, even when no visitors are hitting the site.

在此先感谢!

推荐答案

您可以做到这一点的一些方法。

You can do it a few ways.


  1. 如果您可以控制​​IIS,你可以更改应用程序池中的空闲超时,默认为20分钟。

  2. 如果你没有在IIS(共享或其他托管)的控制,你可以使用外部服务来ping网站。 MyWebKeepAlive Pingdom的是这种不错的选择。

  1. If you have control over IIS, you can change the "Idle Timeout" within the application pool, by default it is 20 minutes.
  2. If you do NOT have control over IIS (Shared or other hosting), you can use an external service to ping the site. MyWebKeepAlive or Pingdom are good options for this.

如果您正在选择二,我强烈建议外部源,因为它是少来管理,如果你没有IIS来配置,你最有可能没有可用来添加一个ping服务器应用程序。

If you are under option two, I strongly recommend an external source, as it is less to manage, and if you don't have IIS available to configure, you most likely don't have the server available to add a ping application to.

另外,我不建议的东西,在过程中与Web应用程序坐镇,因为我已经发现,那些可能会导致问题,当应用程序确实需要回收...

In addition, I do not recommend something that sits in-process with the web application, as I have found that those can cause issues when the application really does need to recycle...

最后一个思想

如果你去修改IIS空闲超时的路线,我不建议设置的应用程序池的常规回收。由于许多Web应用程序都从一个周期性循环中受益,也是最常用的空闲超时是最大的正规回收的因素。

If you do go the route of modifying the IIS Idle timeout, I do recommend setting a regular recycle of the application pool. As many web applications do benefit from a periodic recycle, and most commonly the idle timeout is the biggest regular recycle factor.

这篇关于你可以prevent从关闭ASP.NET应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆