DOWNLOAD DEMO
Current Version: 2.4.0.4 2014-07-18
Need a hand? Join the community.

mojoPortal Hosting Made Easy

Using The AppKeepAlive Task To Speed Up a Low Traffic Site

Use A Site Monitoring Service Instead of AppKeepAlive Task

I no longer recommend using the AppKeepAliveTask, it is far better to use a free service like UptimeRobot or Pingdom to keep your site awake.

Original Article

ASP.NET sites generally suffer from slow performance when the application is just starting to get requests, after a few requests for various pages, the JIT (Just In Time) compiling is all done and it serves requests much faster. The problem is if you don't get much traffic the application shuts down (after 20 minutes of no  requests) then when you finally get a visitor again it has to do all that JIT compiling again so the few visitors you do get all get the slow site experience. A site that gets consistent traffic generally performs much better.

If you look for this in the Web.config:

<add key="UseAppKeepAlive" value="false" />
<add key="AppKeepAliveUrl" value="" /> 

If you set UseAppKeepAlive to true, a background thread will be spawned that makes a request to the site often enough to keep the application pool from shutting down the application due to low traffic.

Ideally you will add this to user.config instead of Web.config so that you do not lose this setting during upgrades.

If using IIS 7 with Integrated Pipeline mode then you must specify the url to the root of your site in AppKeepAliveUrl like http://yoursiteroot/Default.aspx

Keep in mind that once your site starts getting consistent traffic, it is better to disable this.

Another kind of hacky way to keep your site awake is to have a computer at home signed into your site with an edit page open. All our edit pages have a session keep alive feature enabled so it keeps making background requests to the site to prevent your session from timing out while editing content. Not the greatest solution but it does keep your app alive because even if the app is shut down the requests from the browser should start it right back up again.

Modified 12/4/2013 by Joe Audette