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.
<agent type="Sitecore.Tasks.UrlAgent" method="Run" interval="00:01:00">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:
<param desc="url">http://<hostname_here>/sitecore/service/keepalive.aspx</param>
…
</agent>
INFO Scheduling.UrlAgent started. Url:http://127.0.0.1/sitecore/service/keepalive.aspx ERROR Exception in UrlAgent(url: /sitecore/service/keepalive.aspx) Exception: System.Net.WebException Message: The remote server returned an error: (404) NotFound.Note: If you have the exception with another type of error message, please read the following article as well:
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()
<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:
<agent type="Sitecore.Tasks.UrlAgent" method="Run" interval="00:01:00">
<param desc="url">/sitecore/service/keepalive.aspx</param>
<LogActivity>true</LogActivity>
</agent>