I don't found on advanced setting the start mode .. have command to change from OnDemand to always running ?
with PowerShell or something?
set apppool "X" -startMode:AlwaysRunning
I tried that but is not works
my target is to change startmode from ondemand to alwaysrunning
CodePudding user response:
There are prerequisites required to set the application pool or websites always running.
First, the application Initialization Feature must install on the server(IIS 7.5 or above )
Second, the website or application preload is enabled (Set Preload Enabled to True)
The third, application pool start mode: AlwaysRunning
Besides that, these two options, the Idle Time-out and Recycling may cause you problems. You can set the Idle Time-out to 0 to disable time-out and uncheck regular time intervals to disable all recycling
CodePudding user response:
what is your iis version? can you show me the configuration of your website? you can try the following script:
import-module WebAdministration
$websiteName = "MyWebsite"
$appPool = Get-Item IIS:\Sites\$websiteName | Select-Object applicationPool
$appPoolName = $appPool.applicationPool
Set-WebConfiguration -Filter '/system.applicationHost/serviceAutoStartProviders' -Value (@{name="ApplicationPreload";type="WebApplication1.ApplicationPreload, WebApplication1"})
Set-ItemProperty IIS:\Sites\$websiteName -Name applicationDefaults.serviceAutoStartEnabled -Value True
Set-ItemProperty IIS:\Sites\$websiteName -Name applicationDefaults.serviceAutoStartProvider -Value 'ApplicationPreload'
Set-ItemProperty IIS:\AppPools\$appPoolName -Name autoStart -Value True
Set-ItemProperty IIS:\AppPools\$appPoolName -Name startMode -Value 1 #1 = AlwaysRunning, 0 = OnDemand