如何在IIS管理器中为当前和将来的所有应用程序池设置特定时间的回收。
我试图通过设置应用程序池默认值-> Recycling -> Specific Times来实现这一点,但这并不影响已经创建的应用程序池。
有没有什么方法可以做到这一点--也许是通过某种PowerShell脚本?
发布于 2019-12-11 17:51:42
您可以使用以下PowerShell脚本为所有应用程序池设置应用程序池回收时间:
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost/applicationPools/applicationPoolDefaults/recycling/periodicRestart" -name "time" -value "1.08:00:00"
使用命令行:
appcmd.exe set config -section:system.applicationHost/applicationPools /applicationPoolDefaults.recycling.periodicRestart.time:"1.08:00:00" /commit:apphost
要设置定期重新启动值,请执行以下操作:
appcmd.exe set config -section:system.applicationHost/applicationPools /+"applicationPoolDefaults.recycling.periodicRestart.schedule.[value='07:55:00']" /commit:apphost
命令行:
Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost/applicationPools/applicationPoolDefaults/recycling/periodicRestart/schedule" -name "." -value @{value='07:55:00'}
https://stackoverflow.com/questions/59281932
复制相似问题