I have a SharePoint site and a custom ASP.NET site both sitting in IIS 7.0. I'm trying to implement a wakeup mechanism for after the app pools recycle each morning to cache the app pools and avoid the first hit delay that we are all so familiar with. I'v gone ahead and scheduled a task in the task scheduler using the script below, and if I recycle the app pools and run the task, the sites come up right away. I've simulated this multiple times (even running the script through the command line and the script certainly appears to be waking up the sites). However, when I let the task run on it's schedule (of 4am) and then hit the ASP.NET site at 8am, it takes 10-15 secs to wakeup the site upon first hit. The SharePoint sites seem to come up quickly in the morning. I tried updating the IIS setting for timeout idle to 24 hours (it's 20 mins by default) to see if the app pools were recycling themselves again even after the wakeup for the ASP.NET site. Also, Application Initialization is not available until 7.5 (and we are stuck on 7.0 in this scenario). Any suggestions?
Notes: SharePoint sites recycle at 3:30am ASP.NET site recycles at 3:30am Wakeup task runs at 4am
Wakeup script:
# urls to wakeup
$urls = "<url-1>",
"<url-2>"
try
{
# loop through urls
foreach($url in $urls)
{
Write-Host "$url waking up..." -foreground yellow
# wakeup url by fetching page
$client = new-object system.net.WebClient
$client.UseDefaultCredentials = $true
$null = $client.OpenRead($url)
$client.Dispose()
Write-Host "$url now awake..." -foreground green
}
}
catch
{
# exception thrown
Write-Error $_
throw $_
}