Sitecore included its own keep-alive mechanism because IIS does recycle apps by default, and Sitecore wanted to override that behavior out of the box.
Sitecore comes with two built-in features which in tandem prevent application pool timeouts: the KeepAlive
page and the UrlAgent
.
The UrlAgent (Sitecore.Tasks.UrlAgent) is a simple Sitecore agent which accesses a predefined URL at regular intervals.
The keep alive page is basically an empty ASP.NET form which is located in “[webroot]/sitecore/service/keepalive.aspx”.
Out of the box Sitecores Web.config only contains a “naive” UrlAgent configuration: it assumes an application pool timeout of more than one hour and a website which is mapped to localhost, as shown below.
<agent type="Sitecore.Tasks.UrlAgent" method="Run" interval="01:00:00">
<param desc="url">/sitecore/service/keepalive.aspx</param>
<LogActivity>true</LogActivity>
</agent>
To configure the UrlAgent for actual use, copy the XML shown below into a configuration file (e.g. “KeepAliveAgent.config”), change the interval attribute and URL parameter as required, and place it in “[webroot]/App_Config/Include”. Sitecore will merge these settings into the main Web.config file when your site starts up.
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<scheduling>
<!-- The time format is "HH:MM:SS" -->
<agent type="Sitecore.Tasks.UrlAgent" method="Run" interval="00:15:00">
<!-- Replace [WEBSITE] with the appropriate domain -->
<param desc="url">http://[WEBSITE]/sitecore/service/keepalive.aspx</param>
<LogActivity>true</LogActivity>
</agent>
</scheduling>
</sitecore>
</configuration>
When configuring a UrlAgent to prevent application pool timeouts keep the following in mind:
The “interval” attribute value must be less than the application pool
timeout.
Practically the lower limit of the interval is equal to the interval
set in the node “/configuration/sitecore/scheduling/frequency” in
Web.config (expressed as XPath), which is 5 minutes by default.
When not set to an absolute URL, the UrlAgent assumes that the
specified partial URL is located on localhost. In many scenarios this
is not the case (e.g. multiple sites per server), so it’s usually
better to provide a publicly reachable absolute URL.
The “keep alive page” can be any page on the website, but the default
page is well suited since it doesn’t contain any functionality or
visitor tracking scripts.
Reference
What is the purpose of keepalive.aspx?
https://reasoncodeexample.com/2012/03/19/keeping-sitecore-alive/