IIS keep website alive, always running, always on: ASP.NET application auto start, keep app pool alive, with IIS Application Initialization

IIS keep website alive – Scenario:

Somehow what you need is to have IIS keep website alive. You need to keep your ASP.NET website and application pool always running. Regardless of application pool, website, IIS web server, or the entire server restarting.

Perhaps the main reasons could be that you need to initialize some code at the global asax at application start up. To fire up some global application logic. To warm up some pages. Or have an in memory timer in the ASP.NET application memory that routinely runs a schedule. What have you.

And you need to keep the website alive and always running, preventing the application or website from shutting down, or to turn cold because of idling or application pool recycling.

 

IIS keep website alive – Solution:

Since the availability of IIS Application Initialization feature, keeping ASP.NET website and app pool always running is not a complicated task.

You need these IIS prerequisites to keep your ASP.NET website always running:

  1. Application Initialization Feature
  2. Website or Application Preload Enabled
  3. Application Pool Start Mode: AlwaysRunning

 

So here goes…

Application Initialization Feature

Having this feature installed, gives you the ability to make IIS automatically probe your website or web application (like a visitor hitting your page) to keep it active and warm. It can also let you serve a static page (splash page) when your website is starting up.

The Application Initialization Feature can be installed as part of IIS features.

IIS keep website alive - application initialization

Website or Application Preload Enabled

With Preload Enabled option set to true, IIS will simulate a request to ping your website or application as soon as a worker process (w3wp.exe) for your website or application is started. This will warm up your website or application. This dummy request hit will however not be logged in the IIS Log.

IIS keep website alive - preload enabled

Application Pool Start Mode: AlwaysRunning

Making Start Mode option AlwaysRunning will make IIS spawn a new worker process (w3wp.exe) for your website or application whenever IIS is started. Or when your application pool idle time-out and shut down occurs. Or when your application pool is recycled.

IIS keep website alive - always running

With these main ingredients mentioned in place, your website is set to keep running and warm even without real visitors hitting.

 

Other considerations to keep your website or application run properly while always running

  1. Application Pool Idle Time-out
  2. Application Pool Recycling

While achieving a constantly warm and running website or application, it does not mean that there is nothing to worry. These two options, the Idle Time-out and Recycling may cause you problems if you do not understand how it works.

 

Application Pool Idle Time-out
iis-website-application-pool-advanced-settings-idle-time-out

In consideration, you can set the Idle Time-out to 0 to disable time-out. This may sound like a logical idea to not end your application pool process since you want it always running. But if your website or application has memory leak issues, you will be in for a surprise when your memory max out due to this.

 

Application Pool Recycling
iis-website-application-pool-recycling-settings

In consideration, you can disable all recycling options here. This may also sound like you have finally found a total solution to a completely uninterruptible website or application. But memory leak is also a beast here. If your website or application memory is not well programmed or managed.

Hence for memory leak control, it might actually be a good idea to use these features to regularly recycle the application pool to release memory resources. However again, your codes must properly anticipate and handle these recycling interruptions. To reinitialize upon start up or save state during shut down at recycling time.

 

With all these information, you should be able to maintain a properly managed always running website or application that suits your needs.

Have fun!

 

Feel free to see other of my professional produce 🙂
https://www.nickedeye.com/naked/my-produce/

 



Ad: Vodien: Affordable, Reliable and Professional Singapore Web Hosting
Vodien: Affordable, Reliable and Professional Singapore Web Hosting