HTTP 프로토콜 설정 <httpProtocol>

개요

요소는 <httpProtocol> HTTP 연결 유지 연결뿐만 아니라 IIS(인터넷 정보 서비스) 7이 웹 클라이언트에 보내는 사용자 지정 및 리디렉션 응답 헤더를 모두 구성합니다.

브라우저는 일반적으로 전체 웹 페이지를 다운로드하기 위해 여러 요청을 합니다. 서버 성능을 향상시키기 위해 대부분의 웹 브라우저는 HTTP keep-alives라는 기능인 이러한 여러 요청에서 서버가 연결을 열어 두도록 요청합니다. HTTP keep-alive가 없으면 그래픽과 같은 여러 요소가 포함된 페이지에 대해 많은 요청을 하는 브라우저에서 각 요소에 대해 별도의 연결이 필요할 수 있습니다. 이러한 추가 요청 및 연결에는 추가 서버 작업 및 리소스가 필요하므로 서버 효율성이 감소합니다. 또한 추가 연결을 사용하면 브라우저가 훨씬 느리고 응답성이 떨어지며, 특히 연결 속도가 느려집니다.

호환성

버전 참고
IIS 10.0 <httpProtocol> 요소가 IIS 10.0에서 수정되지 않았습니다.
IIS 8.5 <httpProtocol> 요소가 IIS 8.5에서 수정되지 않았습니다.
IIS 8.0 <httpProtocol> 요소가 IIS 8.0에서 수정되지 않았습니다.
IIS 7.5 <httpProtocol> 요소가 IIS 7.5에서 수정되지 않았습니다.
IIS 7.0 요소는 <httpProtocol> IIS 7.0에서 도입되었습니다.
IIS 6.0 요소의 <httpProtocol>allowKeepAlive 특성은 IIS 6.0 AllowKeepAlive 메타베이스 속성을 대체합니다.

설치 프로그램

요소는 <httpProtocol> IIS 7의 기본 설치에 포함됩니다.

방법

웹 사이트 또는 애플리케이션에 HTTP 연결 유지를 사용하도록 설정하는 방법

  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. 연결 창에서 HTTP 연결 유지를 사용하도록 설정할 사이트, 애플리케이션 또는 디렉터리로 이동합니다.

  3. 창에서 HTTP 응답 헤더를 두 번 클릭합니다.
    기본 웹 사이트 홈 페이지의 스크린샷. H T T P 응답 헤더 아이콘이 강조 표시되어 있습니다.

  4. HTTP 응답 헤더 창의 작업 창에서 일반 헤더 설정...을 클릭합니다.
    H T T P 응답 헤더 페이지의 스크린샷

  5. 일반 HTTP 응답 헤더 설정 대화 상자에서 확인란을 검사 HTTP 연결 유지를 사용하도록 설정한 다음 확인을 클릭합니다.
    일반 H T T P 응답 헤더 설정 대화 상자의 스크린샷.

구성

특성

attribute Description
allowKeepAlive 선택적 부울 특성입니다.

keep-alive 처리가 허용되는지(true) 아닌지(false)를 지정합니다.

기본값은 true입니다.

자식 요소

요소 Description
customHeaders 웹 서버의 응답에서 반환되는 사용자 지정 응답 헤더를 구성합니다.
redirectHeaders 웹 서버가 요청을 리디렉션할 때만 응답에 반환되는 응답 헤더를 구성합니다.

구성 샘플

다음 코드 샘플은 기본 웹 사이트에 HTTP keep-alive를 사용하도록 설정합니다.

<configuration>
   <system.webServer>
      <httpProtocol allowKeepAlive="true" />
   </system.webServer>
</configuration>

참고

다음 기본 <httpProtocol> 요소는 IIS 7의 ApplicationHost.config 파일에 구성됩니다.

<httpProtocol>
   <customHeaders>
      <clear />
      <add name="X-Powered-By" value="ASP.NET" />
   </customHeaders>
   <redirectHeaders>
      <clear />
   </redirectHeaders>
</httpProtocol>

샘플 코드

다음 코드 샘플은 기본 웹 사이트에 HTTP keep-alive를 사용하도록 설정합니다.

AppCmd.exe

appcmd.exe set config "Default Web Site" -section:system.webServer/httpProtocol /allowKeepAlive:"True"

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.GetWebConfiguration("Default Web Site");

         ConfigurationSection httpProtocolSection = config.GetSection("system.webServer/httpProtocol");
         httpProtocolSection["allowKeepAlive"] = true;

         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.GetWebConfiguration("Default Web Site")

      Dim httpProtocolSection As ConfigurationSection = config.GetSection("system.webServer/httpProtocol")
      httpProtocolSection("allowKeepAlive") = True

      serverManager.CommitChanges()
   End Sub

End Module

JavaScript

var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST/Default Web Site";

var httpProtocolSection = adminManager.GetAdminSection("system.webServer/httpProtocol", "MACHINE/WEBROOT/APPHOST/Default Web Site");
httpProtocolSection.Properties.Item("allowKeepAlive").Value = true;

adminManager.CommitChanges();

VBScript

Set adminManager = WScript.CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST/Default Web Site"

Set httpProtocolSection = adminManager.GetAdminSection("system.webServer/httpProtocol", "MACHINE/WEBROOT/APPHOST/Default Web Site")
httpProtocolSection.Properties.Item("allowKeepAlive").Value = True

adminManager.CommitChanges()