ConfigurationSectionWithCollection.Add 메서드
구성 섹션의 컬렉션에 요소를 추가합니다.
구문
ConfigurationSectionWithCollection.Add collectionName, element;
ConfigurationSectionWithCollection.Add collectionName, element
매개 변수
이름 | 정의 |
---|---|
collectionName |
string 추가할 컬렉션의 이름을 포함하는 값입니다. |
element |
요소를 추가할 CollectionElement 개체입니다. |
반환 값
이 메서드는 값을 반환하지 않습니다.
설명
메서드를 Add
사용하면 변경한 내용이 자동으로 저장됩니다. 메서드를 사용할 Put_
필요가 없습니다.
예제
다음 예제에서는 기본 웹 사이트에 MIME 맵을 추가합니다.
' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")
' Get the default Web site.
Set oSite = oWebAdmin.Get("Site.Name='Default Web Site'")
' Get the static content section by using the GetSection method.
oSite.GetSection "StaticContentSection", oStaticContentSection
' Get the MimeMapElement class object.
Set oMimeMapElement = oWebAdmin.Get("MimeMapElement")
' Spawn a new instance of the MimeMapElement class.
Set oNewMimeMap = oMimeMapElement.SpawnInstance_
' Assign values to the FileExtension and MimeType properties.
oNewMimeMap.FileExtension = "MyFileExtension"
oNewMimeMap.MimeType = "application/MyApp"
' Add the MIME map to the collection.
oStaticContentSection.Add "StaticContent", oNewMimeMap
요구 사항
형식 | 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 |
참고 항목
CollectionElement 클래스
ConfigurationSectionWithCollection 클래스
MimeMapElement 클래스