ApplicationPool.RevertToParent Method1

将应用程序池的一个或多个配置值还原为默认值。

语法

ApplicationPool.RevertToParent(PropertyName)  
ApplicationPool.RevertToParent(PropertyName);  

参数设置

名称 描述
PropertyName 一个可选的 string 值,该值包含要还原为 ApplicationPoolElementDefaults 类所指定的默认值的应用程序池属性的名称。 该属性可以嵌套。

返回值

此方法不返回值。

注解

在没有参数的情况下调用 RevertToParent 时,将删除应用程序池的所有自定义配置值。 如果这不是你想要的行为,请通过使用对该方法的单独的参数化调用来还原特定属性。

示例

以下示例将 ContosoAppPoolAutoStart 属性从其当前值 false 还原为默认值 true

' Connect to the WMI WebAdministration namespace.  
Set oWebAdmin = GetObject( _  
    "winmgmts:root\WebAdministration")  
  
' Get the application pools.  
Set oAppPools = oWebAdmin.InstancesOf("ApplicationPool")  
  
' Display the ContosoAppPool AutoStart property.  
For Each oAppPool In oAppPools  
    If oAppPool.Name = "ContosoAppPool" Then  
        WScript.Echo "Application pool name: " & oAppPool.Name  
        WScript.Echo "AutoStart mode before revert: " & _  
            oAppPool.AutoStart  
  
        ' Revert the AutoStart property.  
        oAppPool.RevertToParent("AutoStart")  
  
        ' Refresh the oAppPool object variable.  
        oAppPool.Refresh_  
  
        ' Display the changed property.  
        WScript.Echo "AutoStart mode after revert: " & _  
                oAppPool.AutoStart  
  
        Exit For  
    End If  
Next  
  
' Output:  
' Application pool name: ContosoAppPool  
' AutoStart mode before revert: False  
' AutoStart mode after revert: True  
  

要求

类型 描述
客户端 - IIS 7.0(在 Windows Vista 上)
- IIS 7.5(在 Windows 7 上)
- IIS 8.0(在 Windows 8 上)
- IIS 10.0(在 Windows 10 上)
服务器 - IIS 7.0(在 Windows Server 2008 上)
- IIS 7.5(在 Windows Server 2008 R2 上)
- IIS 8.0(在 Windows Server 2012 上)
- IIS 8.5(在 Windows Server 2012 R2 上)
- IIS 10.0(在 Windows Server 2016 上)
产品 - IIS 7.0、IIS 7.5、IIS 8.0、IIS 8.5、IIS 10.0
MOF 文件 WebAdministration.mof

另请参阅

ApplicationPool 类
ApplicationPoolElementDefaults 类