Can You Prevent Your ASP.NET Application from Shutting Down

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

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.

How to keep ASP.NET Core app avoid periodic shutting down in IIS?

Last Friday, I installed the "application initialization", so far the application is running well without shutting down.
Sample Image

How to stop .NET Core application from shutting down when it's dll is overwritten?

I've ended up with writing some kind of shadow copy system.

When my NodeJS app is noticing a new version of the .NET Core app uploaded to the server it renames the folder with the current version ('active') to something like 'old' + timestamp, then renames the new version to 'active'. It is blocking any attempts to launch the app while this renaming process is happening.

This approach helped to completely solve the issue.

How to prevent an ASP.NET application restarting when the web.config is modified?

As far as I am aware there is no way to disable this behavior, changes to the webconfig force the application to be restarted.

Update: it is actually possible, there are a number of methods, well documented, as explained in this answer*

Original answer:

There is a similar question here just for other reference. I found additional info that may be helpful.

Configuration Changes Cause a Restart
of the Application Domain

Changes to
configuration settings in Web.config
files indirectly cause the application
domain to restart. This behavior
occurs by design. You can optionally
use the configSource attribute to
reference external configuration files
that do not cause a restart when a
change is made. For more information,
see configSource in General Attributes
Inherited by Section Elements.

From This MSDN Article

* Disclaimer: I wrote the other answer and normally wouldn't make a self-reference, but find it relevant enough to link here since 8 years after this post it is really quite different: a solution is very easy by clicking through the IIS front-end, and workarounds exist since ASP.NET 1.0.

How to prevent IIS from shutting down Web Site when not in use?

Check Idle Time-out settings under process model in screenshot. That setting is causing app pool shutting down when remain idle for 20 mins. You can set it to 0 to keep it running all time even when its idle i.e. not processing any requests.
Sample Image

Note: Keeping app pool running all time will consume server's precious memory. It may become critical especially if application is leaking memory.



Related Topics



Leave a reply



Submit