기본 바인딩 <바인딩>

개요

요소는 <bindings> 모든 IIS 7 웹 사이트에 대한 기본 바인딩 정보를 구성합니다.

이 요소는 요소의 <binding> 컬렉션을 포함할 수 있습니다. 컬렉션의 각 요소는 요청이 웹 사이트에 연락하는 데 사용할 수 있는 별도의 바인딩 정보 집합을 정의합니다. 예를 들어 사이트에서 사용자가 HTTP 프로토콜과 HTTPS 프로토콜을 모두 사용하여 연결하도록 요구하는 경우 각 프로토콜에 대한 바인딩을 정의해야 합니다.

요소의 <site> 요소에 있는 <bindings> 요소를 사용하여 <clear /> 서버 수준 <siteDefaults> 요소에서 상속된 바인딩 기본값을 재정의할 수도 있습니다.

호환성

버전 참고
IIS 10.0 <bindings> 요소가 IIS 10.0에서 수정되지 않았습니다.
IIS 8.5 <bindings> 요소가 IIS 8.5에서 수정되지 않았습니다.
IIS 8.0 <bindings> 요소가 IIS 8.0에서 수정되지 않았습니다.
IIS 7.5 <bindings> 요소가 IIS 7.5에서 수정되지 않았습니다.
IIS 7.0 요소는 <bindings> IIS 7.0에서 도입되었습니다.
IIS 6.0 컬렉션은 <bindings> IIS 6.0 IIsWebServer 메타베이스 개체의 ServerBindings 속성 섹션을 대체합니다.

설치 프로그램

요소는 <bindings> 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. 웹 사이트 기본값 대화 상자에서 모든 웹 사이트에 대한 기본 옵션을 지정한 다음 확인을 클릭합니다.

    일반 및 동작 섹션을 보여 주는 웹 사이트 기본값 대화 상자의 스크린샷

구성

서버에 대한 기본 프로토콜 바인딩을 정의하는 개별 <binding> 요소의 컬렉션을 포함할 수 있는 서버에 대한 요소를 추가할 <bindings> 수 있습니다. 요소의 <site> 요소에 있는 <bindings> 요소를 사용하여 <clear /> 서버 수준 <siteDefaults> 요소에서 상속된 바인딩 기본값을 재정의할 수도 있습니다.

특성

없음

자식 요소

요소 Description
binding 선택적 요소입니다.

기본 바인딩을 구성합니다.
clear 선택적 요소입니다.

기본 바인딩의 컬렉션을 지웁니다.

구성 샘플

다음 구성 샘플은 IIS 7에 대한 기본 bindings 옵션을 지정합니다.

<system.applicationHost>
   <sites>
      <siteDefaults>
         <bindings>
            <binding protocol="http" bindingInformation="127.0.0.1:8080:" />
         </bindings>
      </siteDefaults>
   </sites>
</system.applicationHost>

샘플 코드

다음 코드 샘플은 IIS 7에 대한 기본 bindings 옵션을 구성합니다.

AppCmd.exe

appcmd.exe set config -section:system.applicationHost/sites /siteDefaults.bindings.[protocol='http',bindingInformation='*:8080:contoso.com'].bindingInformation:"127.0.0.1:8080:" /commit:apphost

참고

AppCmd.exe 사용하여 이러한 설정을 구성할 때 commit 매개 변수 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 siteDefaultsElement = sitesSection.GetChildElement("siteDefaults");

         ConfigurationElementCollection bindingsCollection = siteDefaultsElement.GetCollection("bindings");
         ConfigurationElement bindingElement = bindingsCollection.CreateElement("binding");
         bindingElement["protocol"] = @"http";
         bindingElement["bindingInformation"] = @"127.0.0.1:8080:";
         bindingsCollection.Add(bindingElement);

         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 siteDefaultsElement As ConfigurationElement = sitesSection.GetChildElement("siteDefaults")

      Dim bindingsCollection As ConfigurationElementCollection = siteDefaultsElement.GetCollection("bindings")
      Dim bindingElement As ConfigurationElement = bindingsCollection.CreateElement("binding")
      bindingElement("protocol") = "http"
      bindingElement("bindingInformation") = "127.0.0.1:8080:"
      bindingsCollection.Add(bindingElement)

      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 siteDefaultsElement = sitesSection.ChildElements.Item("siteDefaults");

var bindingsCollection = siteDefaultsElement.ChildElements.Item("bindings").Collection;
var bindingElement = bindingsCollection.CreateNewElement("binding");
bindingElement.Properties.Item("protocol").Value = "http";
bindingElement.Properties.Item("bindingInformation").Value = "127.0.0.1:8080:";
bindingsCollection.AddElement(bindingElement);

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 siteDefaultsElement = sitesSection.ChildElements.Item("siteDefaults")

Set bindingsCollection = siteDefaultsElement.ChildElements.Item("bindings").Collection
Set bindingElement = bindingsCollection.CreateNewElement("binding")
bindingElement.Properties.Item("protocol").Value = "http"
bindingElement.Properties.Item("bindingInformation").Value = "127.0.0.1:8080:"
bindingsCollection.AddElement(bindingElement)

adminManager.CommitChanges()