다음을 통해 공유


ConfigurationSection.RevertToParent 메서드

섹션의 구성 값을 기본값으로 되돌려 놓습니다.

구문

ConfigurationSection.RevertToParent();  
ConfigurationSection.RevertToParent(PropertyName);  
ConfigurationSection.RevertToParent  
ConfigurationSection.RevertToParent(PropertyName)  

매개 변수

이름 정의
PropertyName 구성 섹션에 있는 속성의 이름을 포함하는 선택적 string 값입니다. 속성은 중첩될 수 있습니다(예: oLogSection.RevertToParent("CentralBinaryLogFile.Directory")).

반환 값

이 메서드는 값을 반환하지 않습니다.

설명

이 메서드는 구성 파일에 기록된 구성 값을 삭제하는 방법을 제공합니다.

예제

다음 예제에서는 메서드를 사용하는 RevertToParent 두 가지 방법을 보여줍니다.

  1. 첫 번째 부분은 지정된 속성을 기본값으로 되돌려 줍니다. 예제의 다음 줄은 속성 DefaultDocumentSection 이름을 매개 변수로 RevertToParent 지정하여 기본 웹 사이트의 속성을 되돌려 줍니다Enabled.

    oDefaultDocumentSection.RevertToParent("Enabled")  
    

    그러면 기본 웹 사이트의 Web.config 파일에 지정된 의 값 false이 제거되고 기본값 true으로 바뀝니다.

  2. 두 번째 부분은 전체 섹션을 기본값으로 되돌려 놓습니다. 예제의 다음 줄은 에 대한 RevertToParent매개 변수를 지정하지 않고 기본 웹 사이트의 전체 DefaultDocumentSection 콘텐츠를 되돌려 줍니다.

    oDefaultDocumentSection.RevertToParent  
    

    그러면 기본 웹 사이트의 Web.config 파일의 기본 문서 섹션에서 모든 값이 제거됩니다. 기본 웹 사이트의 기본값은 제거된 값을 대체합니다.

' Connect to the WMI WebAdministration namespace.  
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")  
  
' Get the DefaultDocumentSection for the Default Web Site.  
Set oSite=oWebAdmin.Get("Site.Name='Default Web Site'")  
oSite.GetSection "DefaultDocumentSection", oDefaultDocumentSection  
  
' 1. Revert the Enabled property to its default value.  
oDefaultDocumentSection.RevertToParent("Enabled")  
  
' 2. Revert the entire default document section.  
oDefaultDocumentSection.RevertToParent  
  

요구 사항

형식 Description
클라이언트 - Windows Vista의 IIS 7.0
- Windows 7의 IIS 7.5
- Windows 8의 IIS 8.0
- WINDOWS 10 IIS 10.0
서버 - Windows Server 2008의 IIS 7.0
- Windows Server 2008 R2의 IIS 7.5
- Windows Server 2012의 IIS 8.0
- Windows Server 2012 R2의 IIS 8.5
- WINDOWS SERVER 2016 IIS 10.0
제품 - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
MOF 파일 WebAdministration.mof

참고 항목

ConfigurationSection 클래스
ConfigurationSectionWithCollection 클래스
ConfiguredObject 클래스
DefaultDocumentSection 클래스