I was recently required to provide a solution for a DotNetNuke keep alive service. There are many solutions available within the community, a free version exists called DNN monitor (http://www.dnnmonitor.com/) which seems to provide an excellent service (or that is what the benefits of the service suggests!).
The requirement for the above is to prevent ASP.NET releasing the resources when the DNN site has been idle, which would require the site to be recompiled and loaded again which will create an initial delay. The keep alive service will keep the application pool alive during idle periods and therefore help to optimise performance.
This solution was to be a tempoary workaround until a monitoring application was to be installed, which in turn by actively monitoring the website will prevent ASP.NET releasing the resources due to the site being idle.
This was compiled using Windows Powershell and initialising an instance of the .NET WebClient class. The keep alive service will need to run every 10 minutes, so I will invoke the script block in a loop while the condition is set to be ‘true’ and use the Start-Sleep cmdlet to suspend the script block for a period of 10 minutes (10*60).
The process of keeping the application pool alive is handled by specifying the keep alive ASPX page to be downloaded as a specified string using the ‘WebClient.DownloadString.Method’. In this instance the host header is ‘www.domain.local’ and the keepalive.aspx file is located in the virtual directory ‘dnn’.
$WebClient = New-Object Net.WebClient
Sleep -Seconds (10*60)
The above may be invoked using task scheduler to run at startup, can be run as a background job from a logged on session or the powershell script could be wrapped up as a windows service .