Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you prevent your ASP.NET application from shutting down?

Tags:

c#

asp.net

iis

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

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.

Thanks in advance!

like image 648
John B Avatar asked Aug 20 '09 13:08

John B


People also ask

What are the most important performance issues in ASP.NET web applications?

High response time of the ASP.NET request handling service. High CLR wait time. Improper caching. HTTP errors including static and dynamic content errors and connection errors.

Which ASP NET core no longer depends on the system?

Fast: ASP.NET Core no longer depends on System. Web. dll for browser-server communication. ASP.NET Core allows us to include packages that we need for our application.


1 Answers

You can do it a few ways.

  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.

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.

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...

One last thought

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.

like image 79
Mitchel Sellers Avatar answered Oct 06 '22 01:10

Mitchel Sellers