如何使用powershell设置IIS6应用程序池的空闲超时?我在搜索中看到的只是如何设置应用程序池的回收时间并不完全相同。
这就是出现的情况,但我认为这不是我想要的:
$destinationPool.recycling.periodicRestart.schedule
答案 0 :(得分:1)
我无法测试,但试试这个:
$ApplicationPool = Get-WmiObject -Class IISApplicationPoolSetting -Namespace "root/microsoftiisv2" | Where-Object {$_.Name -eq 'W3SVC/APPPOOLS/DefaultAppPool'}
$ApplicationPool.IdleTimeout=0
$ApplicationPool.Put()
答案 1 :(得分:1)
使用DSC(所需状态配置)
cAppPool $application.AppPool.Name
{
Name = $application.AppPool.Name
AutoStart = $application.AppPool.AutoStart
StartMode = $application.AppPool.StartMode
ManagedRuntimeVersion = $application.AppPool.ManagedRuntimeVersion
ManagedPipelineMode = $application.AppPool.ManagedPipelineMode
IdentityType = $application.AppPool.IdentityType
LoadUserProfile = $application.AppPool.LoadUserProfile
Ensure = "Present"
idleTimeout = "00:00:00"
}
idleTimeout
是string
而不是int
类型的事实让我感到困惑了一段时间。尝试静默使用"0"
会使其默认为20分钟