다음을 통해 공유


ConfigurationSection.SetAllowDefinition 메서드

구성 섹션의 allowDefinition 특성을 설정합니다.

구문

ConfigurationSection.SetAllowDefinition(AllowDefinition)  
ConfigurationSection.SetAllowDefinition(AllowDefinition);  

매개 변수

이름 정의
AllowDefinition string 특성이 설정될 값을 지정하는 allowDefinition 변수입니다. 가능한 특성 값은 설명 섹션의 뒷부분에 나와 있습니다.

반환 값

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

설명

allowDefinition 특성은 지정된 구성 섹션에 대해 구성 계층 구조 값이 설정될 수 있는 위치를 지정합니다. 이러한 특성은 ApplicationHost.config 파일의 섹션에 지정됩니다 <configSections> .

SetAllowDefinition 정적 메서드이므로 다음 예제와 같이 클래스 개체를 가져오면 호출해야 합니다.

' Correct syntax:  
Set oAnonAuth = oWebAdmin.Get("AnonymousAuthenticationSection")  
oAnonAuth.SetAllowDefinition "MachineOnly"  

클래스의 구체적인 instance 호출 SetAllowDefinition 하려고 하므로 다음 구문이 Site 실패합니다. 메서드를 호출하면 "SWbemObjectEx: 찾을 수 없음" 오류가 발생합니다.

' Incorrect syntax:  
Set oSite = oWebAdmin.Get("Site.Name='Default Web Site'")  
oSite.GetSection "AnonymousAuthenticationSection", oAnonAuth  
oAnonAuth.SetAllowDefinition "MachineOnly"  

다음 표에서는 특성에 사용할 수 있는 값을 나열합니다 allowDefinition .

키워드 Description
Everywhere 섹션은 계층 구조의 아무 곳이나 설정할 수 있습니다.
MachineOnly 섹션은 Machine.config 파일에서만 설정할 수 있습니다. 참고: Machine.config 파일의 기본 위치는 %systemroot% Microsoft.NET\Framework\<version>\config\입니다.
MachineToWebRoot 섹션은 Machine.config 파일 또는 루트 Web.config 파일에서만 설정할 수 있습니다. 참고: 루트 Web.config 파일의 기본 위치는 %systemroot% Microsoft.NET\Framework\<version>\config\입니다.
AppHostOnly 섹션은 ApplicationHost.config 파일에서만 설정할 수 있습니다.
MachineToApplication 섹션은 전역 수준에서만 설정할 수 있습니다. .NET Framework 섹션의 경우 전역 수준은 루트 Web.config 또는 Machine.config 파일입니다. IIS 섹션의 경우 ApplicationHost.config 파일이며 애플리케이션의 경우 루트 애플리케이션에 대한 Web.config 파일입니다.

예제

다음 예제에서는 익명 인증 구성 섹션에 대한 특성을 설정합니다 allowDefinition .

' Get the WebAdministration namespace.  
Set oWebAdmin = GetObject( _  
    "winmgmts:root\WebAdministration")  
  
' Get the AnonymousAuthenticationSection.  
Set oAnonAuth = oWebAdmin.Get( _  
    "AnonymousAuthenticationSection")  
  
' Set the AllowDefinition attribute.  
oAnonAuth.SetAllowDefinition "MachineToApplication"  
  

요구 사항

형식 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

참고 항목

AnonymousAuthenticationSection 클래스
ConfigurationSection 클래스
ConfigurationSection.GetAllowDefinition 메서드