0

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 $_
}
0

The easiest way to workaround this issue immediately is probably just to increase the interval that your script runs to something like every hour or every half hour.

But that doesn't satisfy the need to understand what's really happening. Unfortunately, I don't have any IIS 7.0 boxes or VMs handy. But my gut says there's still something in the App Pool settings that would be causing them to spin down. The other possibility is that one or more of the ASP.NET apps is crashing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.