Iis 在特定时间回收所有应用程序池

Iis 在特定时间回收所有应用程序池,iis,application-pool,recycle,Iis,Application Pool,Recycle,如何在IIS管理器中为当前和将来的所有应用程序池设置特定时间的回收 我试图通过设置应用程序池默认值->回收->特定时间来实现这一点,但这不会影响已经创建的应用程序池 有没有办法做到这一点-也许是通过某种PowerShell脚本 您可以使用下面的PowerShell脚本设置所有应用程序池的应用程序池回收时间: Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.applicationHost

如何在IIS管理器中为当前和将来的所有应用程序池设置特定时间的回收

我试图通过设置应用程序池默认值->回收->特定时间来实现这一点,但这不会影响已经创建的应用程序池


有没有办法做到这一点-也许是通过某种PowerShell脚本

您可以使用下面的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
Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.applicationHost/applicationPools/applicationPoolDefaults/recycling/periodicRestart/schedule" -name "." -value @{value='07:55:00'}
要设置定期重新启动值,请执行以下操作:

appcmd.exe set config  -section:system.applicationHost/applicationPools /+"applicationPoolDefaults.recycling.periodicRestart.schedule.[value='07:55:00']" /commit:apphost
命令行:

appcmd.exe set config  -section:system.applicationHost/applicationPools /applicationPoolDefaults.recycling.periodicRestart.time:"1.08:00:00"  /commit:apphost
Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.applicationHost/applicationPools/applicationPoolDefaults/recycling/periodicRestart/schedule" -name "." -value @{value='07:55:00'}

您可以使用下面的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
Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.applicationHost/applicationPools/applicationPoolDefaults/recycling/periodicRestart/schedule" -name "." -value @{value='07:55:00'}
要设置定期重新启动值,请执行以下操作:

appcmd.exe set config  -section:system.applicationHost/applicationPools /+"applicationPoolDefaults.recycling.periodicRestart.schedule.[value='07:55:00']" /commit:apphost
命令行:

appcmd.exe set config  -section:system.applicationHost/applicationPools /applicationPoolDefaults.recycling.periodicRestart.time:"1.08:00:00"  /commit:apphost
Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.applicationHost/applicationPools/applicationPoolDefaults/recycling/periodicRestart/schedule" -name "." -value @{value='07:55:00'}