Okay, so I'm basically in the process of implementing azure warmups using the new IIS 8.0 Application Initialization module.
I've got a startup task (cmd file) that basically already cancels out the idle timeout in IIS and the recycling time. I'm trying to add application initialization to that.
I realise that I need to set two things; startMode
and preloadEnabled
.
My application has numerous sites in IIS (around 10), all randomly named by Azure with their own randomly named Application Pools.
startMode
is easy, as that can be set as an application pool default by doing:
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.startMode:AlwaysRunning
That applies it to all the application pools.
However, it's not so easy with preloadEnabled
.
To set preloadEnabled
, you can use this for a named site:
%windir%\system32\inetsrv\appcmd set config -section:sites [name='MySite'].applicationDefaults.preloadEnabled
But I need it to apply to ALL sites that I don't know the name of (they're random), kind of a default (how I have set startMode
).
Any ideas?
After a day of searching for it, I've finally got it. It basically uses a loop in appcmd by using the pipe to chain commands together (kinda like a for
loop). Here it is:
%systemroot%\system32\inetsrv\AppCmd.exe list app /xml | %windir%\system32\inetsrv\appcmd set site /in -applicationDefaults.preloadEnabled:True