Keeping the ASP.NET worker process alive

Vish's picture

You may have noticed that it sometimes takes a while for a new ASP.NET session to start up. This is because if there are no users on a website, the ASP.NET worker process gets recycled. ASP.NET application will remain active only as long as there are active ASP.NET sessions. The next time a user visits your website, ASP.NET compiles your application again. This can cause a delay of 10-20 seconds (or more depending on system resources) for your website to come up.

This "lag" can cause a lot of discomfort to users who may feel that your website is "slow". Of course this problem wont exist if you had a lot of continuous traffic on your site. I did some extensive research on this subject and found a couple of options.

Option1: Use a monitoring service to keep your website "alive"
This is probably the easiest and most used option. Setup a monitoring service to ping your website every 20 seconds or so. This will keep renewing the session and hence keep your application alive. You should probably have the monitoring service hit a page that does not cause too much load on the server - For instance the page could simply display the current time.

In the next version (v4.5) of Znode Storefront, we will be including a file called "Monitor.aspx" which will provide this functionality.

There are a number of good monitoring services that you can use. We recommend the WebsitePulse monitoring service.

There are also some downloadable software that you can install and run on your own servers. Here's a really nice one - www.paessler.com

Option2: Change the process model settings
This option requires modifications to the machine.config file on your server so use caution! This will result in the setting being changed for all websites on your server.

Change the ProcessModel element in your machine.config file and set the IdleTimeout parameter to "Infinite"

Click here for the MSDN reference for ProcessModel