IIS 애플리케이션 기본값 applicationDefaults <>

개요

<applicationDefaults><sites> 요소는 서버의 모든 앱에 대한 기본 앱 설정을 지정합니다.

참고

특정 애플리케이션에 대한 섹션과 <application> 섹션 모두에서 <applicationDefaults> 동일한 특성 또는 자식 요소가 구성된 경우 섹션의 <application> 구성이 해당 애플리케이션에 사용됩니다.

호환성

버전 참고
IIS 10.0 <applicationDefaults> 요소가 IIS 10.0에서 수정되지 않았습니다.
IIS 8.5 <applicationDefaults> 요소가 IIS 8.5에서 수정되지 않았습니다.
IIS 8.0 <applicationDefaults> 요소가 IIS 8.0에서 수정되지 않았습니다.
IIS 7.5 <applicationDefaults> 요소가 IIS 7.5에서 수정되지 않았습니다.
IIS 7.0 <applicationDefaults> 요소의 <sites> 요소는 IIS 7.0에서 도입되었습니다.
IIS 6.0 요소는 <applicationDefaults> IIS 6.0 메타베이스의 W3SVC 수준에서 애플리케이션 옵션을 설정하는 것과 유사합니다.

설치 프로그램

<applicationDefaults> 요소의 <sites> 요소는 IIS 7 이상의 기본 설치에 포함됩니다.

방법

서버에 대한 기본 애플리케이션 설정을 구성하는 방법

  1. IIS(인터넷 정보 서비스) 관리자를 엽니다.

    • Windows Server 2012 또는 Windows Server 2012 R2를 사용하는 경우:

      • 작업 표시줄에서 서버 관리자 클릭하고 도구를 클릭한 다음 IIS(인터넷 정보 서비스) 관리자를 클릭합니다.
    • Windows 8 또는 Windows 8.1 사용하는 경우:

      • Windows 키를 누른 채로 문자 X를 누른 다음 제어판 클릭합니다.
      • 관리 도구를 클릭한 다음 IIS(인터넷 정보 서비스) 관리자를 두 번 클릭합니다.
    • Windows Server 2008 또는 Windows Server 2008 R2를 사용하는 경우:

      • 작업 표시줄에서 시작을 클릭하고 관리 도구를 가리킨 다음 IIS(인터넷 정보 서비스) 관리자를 클릭합니다.
    • Windows Vista 또는 Windows 7을 사용하는 경우:

      • 작업 표시줄에서 시작을 클릭한 다음 제어판 클릭합니다.
      • 관리 도구를 두 번 클릭한 다음 IIS(인터넷 정보 서비스) 관리자를 두 번 클릭합니다.
  2. 연결 창에서 서버 이름을 확장한 다음 사이트 노드를 클릭합니다.

  3. 서버의 사이트 창에서 작업 창에서 웹 사이트 기본값 설정...을 클릭합니다.
    스크린샷은 작업 창에 웹 사이트 기본값 설정 탭이 있는 사이트 창을 보여줍니다.

  4. 웹 사이트 기본값 대화 상자에서 모든 웹 사이트에 대한 기본 애플리케이션 설정을 지정한 다음 확인을 클릭합니다.
    애플리케이션 풀이 강조 표시된 웹 사이트 기본값 대화 상자의 스크린샷

구성

특성

attribute Description
applicationPool 선택적 문자열 특성입니다.

서버의 모든 애플리케이션이 할당되는 기본 애플리케이션 풀을 지정합니다.
enabledProtocols 선택적 문자열 특성입니다.

서버의 모든 애플리케이션과 통신하는 데 사용할 프로토콜을 지정합니다.
path 선택적 문자열 특성입니다.

서버에 있는 모든 애플리케이션의 기본 가상 경로를 지정합니다.

자식 요소

없음

구성 샘플

다음 구성 샘플에서는 모든 웹 사이트의 기본 애플리케이션 풀을 "DefaultAppPool"로 설정합니다.

<system.applicationHost>
   <sites>
     <applicationDefaults applicationPool="DefaultAppPool" />
   </sites>
</system.applicationHost>

샘플 코드

다음 코드 샘플은 모든 웹 사이트의 기본 애플리케이션 풀을 "DefaultAppPool"로 설정합니다.

AppCmd.exe

appcmd.exe set config -section:system.applicationHost/sites /applicationDefaults.applicationPool:"DefaultAppPool" /commit:apphost

참고

AppCmd.exe 사용하여 이러한 설정을 구성할 때 커밋 매개 변수 apphost 를 로 설정해야 합니다. 그러면 구성 설정이 ApplicationHost.config 파일의 적절한 위치 섹션에 커밋됩니다.

C#

using System;
using System.Text;
using Microsoft.Web.Administration;

internal static class Sample
{
   private static void Main()
   {
      using (ServerManager serverManager = new ServerManager())
      {
         Configuration config = serverManager.GetApplicationHostConfiguration();
         ConfigurationSection sitesSection = config.GetSection("system.applicationHost/sites");

         ConfigurationElement applicationDefaultsElement = sitesSection.GetChildElement("applicationDefaults");
         applicationDefaultsElement["applicationPool"] = @"DefaultAppPool";

         serverManager.CommitChanges();
     }
   }
}

VB.NET

Imports System
Imports System.Text
Imports Microsoft.Web.Administration

Module Sample

   Sub Main()
      Dim serverManager As ServerManager = New ServerManager
      Dim config As Configuration = serverManager.GetApplicationHostConfiguration
      Dim sitesSection As ConfigurationSection = config.GetSection("system.applicationHost/sites")

      Dim applicationDefaultsElement As ConfigurationElement = sitesSection.GetChildElement("applicationDefaults")
      applicationDefaultsElement("applicationPool") = "DefaultAppPool"

      serverManager.CommitChanges()
   End Sub

End Module

JavaScript

var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
var sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST");

var applicationDefaultsElement = sitesSection.ChildElements.Item("applicationDefaults");
applicationDefaultsElement.Properties.Item("applicationPool").Value = "DefaultAppPool";

adminManager.CommitChanges();

VBScript

Set adminManager = WScript.CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST")

Set applicationDefaultsElement = sitesSection.ChildElements.Item("applicationDefaults")
applicationDefaultsElement.Properties.Item("applicationPool").Value = "DefaultAppPool"

adminManager.CommitChanges()