我有幾個服務器場,其中一個服務器爲Server 2008 R2
,另一個服務器爲Server 2012 R2
。一堆搜索後,我發現下面的PowerShell來禁用默認的IIS應用程序池回收,這是我在行政PowerShell提示符下運行:Set-ItemProperty IIS: AppPools [App_Pool] -Name Recycling.PeriodicRestart.Time在服務器2012 R2中沒有任何作用
Set-ItemProperty IIS:\AppPools\Test -Name Recycling.PeriodicRestart.Time -Value 0
這似乎是工作罰款(運行沒有任何平臺上的任何輸出) ,但是當我隨後嘗試查詢值,上Server 2008 R2
,我得到這個:
PSPath : WebAdministration::\\SERVER1\AppPools\Test
PSParentPath : WebAdministration::\\SERVER1\AppPools
PSChildName : Test
PSDrive : IIS
PSProvider : WebAdministration
IsInheritedFromDefaultValue : False
IsProtected : False
Name : time
TypeName : System.TimeSpan
Schema : Microsoft.IIs.PowerShell.Framework.ConfigurationAttributeSchema
Value : 00:00:00
IsExtended : False
但Server 2012 R2
,我得到這個:
PSPath : WebAdministration::\\SERVER2\AppPools\Test
PSParentPath : WebAdministration::\\SERVER2\AppPools
PSChildName : Test
PSDrive : IIS
PSProvider : WebAdministration
IsInheritedFromDefaultValue : True
IsProtected : False
Name : time
TypeName : System.TimeSpan
Schema : Microsoft.IIs.PowerShell.Framework.ConfigurationAttributeSchema
Value : 1.05:00:00
IsExtended : False
請注意,第一個示例中的Value
是00:00:00
,但在第二個示例中是1.05:00:00
。這是從DefaultAppPool
繼承的默認值。
我已經嘗試改變DefaultAppPool
價值爲好,但我得到相同的結果 - 它適用於2008 R2
但不能2012 R2
,所以我相當肯定,傳承不是問題。
在Server 2012 R2
中是否有一些替代方法可以做到這一點,以便它不會忽略該命令或更好的方法 - 在Server 2008 R2
和Server 2012 R2
中都可以使用的方法?
不錯的發現,這是一個真正的意思。另外我們注意到在我們的團隊中,區分大小寫還取決於PowerShell版本。在5.0中,'Set-Item'不關心大小寫,它在'5.1'中。 –
或者它取決於IIS版本。 IIS 7.5忽略大小寫。 IIS 10沒有。 –