Question

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?

Was it helpful?

Solution

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

OTHER TIPS

For IIS 8.5, to Set, the preload at the application level (not at Site Level) using appcmd, following command should be utilized.

appcmd set app "Default Web Site/ApplicationName" /preloadenabled:true

For those still on IIS 7.5:

In windows Server 2012 R2 and IIS 8.5 in to CMD Adminitrator.

cd C:\Windows\System32\inetsrv && appcmd list app /xml | appcmd set site /in -applicationDefaults.preloadEnabled:True /commit:apphost

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top