Automatic site recycling after the site has been idle for a period

  • Description

    Sitecore’s UrlAgent, which helps keep sites in a warmed-up state, may not work properly by default and requires additional configuration. If this is not done, the site may automatically be recycled after it has been idle for a period.

    Under the default IIS configuration, ASP.NET will recycle the application pool for a web site when no web requests have handled by the web site for a defined period of inactivity (20 minutes by default).

    Sitecore CMS contains a keep-alive UrlAgent designed to prevent automatic recycling of the worker process under such conditions. This may help keeping the site in a warmed-up state and increase the speed of handling first requests after a period of inactivity.

    The solutions below describe how to configure Sitecore CMS so that the site will stay in the warmed-up state and not automatically recycle after a period of inactivity.

  • Use the UrlAgent to keep the site alive.

    1. Add the hostname of your site to the "url" parameter:
      <agent type="Sitecore.Tasks.UrlAgent" method="Run" interval="00:01:00">
               <param desc="url">http://<hostname_here>/sitecore/service/keepalive.aspx</param>
      This step is only needed in case the following error can be found in the Sitecore log files. The error may occur when running IIS in the Integrated mode and the Sitecore website is not configured to handle requests that use "localhost" as a hostname:
      INFO  Scheduling.UrlAgent started. Url:
      ERROR Exception in UrlAgent(url: /sitecore/service/keepalive.aspx)
      Exception: System.Net.WebException
      Message: The remote server returned an error: (404) NotFound.
      Source: System
         at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
         at System.Net.WebClient.DownloadData(Uri address)
         at Sitecore.Web.WebUtil.ExecuteWebPage(String url, NameValueCollection headers)
         at Sitecore.Tasks.UrlAgent.Run()
      Note: If you have the exception with another type of error message, please read the following article as well:
      Errors caused by incorrect configuration of UrlAgent
    2. Set the interval attribute to a value that is less than the "Idle time-out" property of the application pool, for example to 15 minutes.
      <agent type="Sitecore.Tasks.UrlAgent" method="Run" interval="00:15:00">
  • To stop IIS from automatically recycling the site and do not use the UrlAgent:

    1. Comment out the following lines in web.config:

      <agent type="Sitecore.Tasks.UrlAgent" method="Run" interval="00:01:00">
      <param desc="url">/sitecore/service/keepalive.aspx</param>

    2. For IIS 6, uncheck "Shutdown worker processes after being idle" checkbox in the "Performance" tab of the application pool properties. 
      For IIS 7 and later, set "Idle Time-out" property to 0 in the "Advanced Settings" dialog of the application pool configuration.

Applies to:

CMS 6.0 - 6.6.0 Update-3

CMS 6.6.0 Update-4

March 11, 2014
December 10, 2014

Reference number:

366123, 378635


  • CMS,
  • Performance