Share via


동적 형식 <dynamicTypes>

개요

<dynamicTypes> 요소의 <httpCompression> 요소에는 IIS 7이 동적으로 압축할 형식 목록에 고유한 MIME 형식을 추가하는 요소 컬렉션 <add> 이 포함되어 있습니다.

참고

특정 파일 이름 확장명을 "동적 콘텐츠"로 정의한 IIS 6.0 HcScriptFileExtensions 메타베이스 속성과 달리 IIS 7은 요소를 사용하여 <dynamicTypes> IIS 7이 동적으로 압축할 MIME 형식을 지정하고 요소의 <handlers> 매핑을 사용하여 정적 또는 동적 콘텐츠를 참조하는 파일 이름 확장을 지정합니다.

호환성

버전 참고
IIS 10.0 <dynamicTypes> 요소가 IIS 10.0에서 수정되지 않았습니다.
IIS 8.5 <dynamicTypes> 요소가 IIS 8.5에서 수정되지 않았습니다.
IIS 8.0 <dynamicTypes> 요소가 IIS 8.0에서 수정되지 않았습니다.
IIS 7.5 <dynamicTypes> 요소가 IIS 7.5에서 수정되지 않았습니다.
IIS 7.0 <dynamicTypes> 요소의 <httpCompression> 요소는 IIS 7.0에서 도입되었습니다.
IIS 6.0 요소는 <dynamicTypes> IIS 6.0 HcScriptFileExtensions 메타베이스 속성과 다소 유사합니다.

설치 프로그램

HTTP 압축은 일반적으로 IIS 7 이상의 기본 설치에서 사용할 수 있습니다. 그러나 정적 압축만 기본적으로 설치됩니다. 정적 또는 동적 압축을 설치하려면 다음 단계를 사용합니다.

Windows Server 2012 또는 Windows Server 2012 R2

  1. 작업 표시줄에서 서버 관리자를 클릭합니다.
  2. 서버 관리자관리 메뉴를 클릭한 다음 역할 및 기능 추가를 클릭합니다.
  3. 역할 및 기능 추가 마법사에서 다음을 클릭합니다. 설치 유형을 선택하고 다음을 클릭합니다. 대상 서버를 선택하고 다음을 클릭합니다.
  4. 서버 역할 페이지에서 웹 서버(IIS)를 확장하고 웹 서버를 확장하고 성능을 확장한 다음 정적 콘텐츠 압축 및/또는 동적 콘텐츠 압축을 선택합니다. 다음을 클릭합니다.
    선택되고 강조 표시된 동적 콘텐츠 압축 옵션의 스크린샷 .
  5. 기능 선택 페이지에서 다음을 클릭합니다.
  6. 설치 선택 확인 페이지에서 설치를 클릭합니다.
  7. Results(결과) 페이지에서 Close(닫기)를 클릭합니다.

Windows 8 또는 Windows 8.1

  1. 시작 화면에서 포인터를 왼쪽 아래 모서리로 이동하고 시작 단추를 마우스 오른쪽 단추로 클릭한 다음 제어판 클릭합니다.
  2. 제어판프로그램 및 기능을 클릭한 다음 Windows 기능 켜기 또는 끄기를 클릭합니다.
  3. 인터넷 정보 서비스를 확장하고, World Wide Web Services를 확장하고, 성능 기능을 확장한 다음, 동적 콘텐츠 압축 및/또는 정적 콘텐츠 압축을 선택합니다.
    강조 표시되고 선택되는 정적 콘텐츠 압축 폴더의 스크린샷
  4. 확인을 클릭합니다.
  5. 닫기를 클릭합니다.

Windows Server 2008 또는 Windows Server 2008 R2

  1. 작업 표시줄에서 시작을 클릭하고 관리 도구를 가리킨 다음 서버 관리자 클릭합니다.
  2. 서버 관리자 계층 구조 창에서 역할을 확장한 다음 웹 서버(IIS)를 클릭합니다.
  3. 웹 서버(IIS) 창에서 Role Services 섹션으로 스크롤한 다음 역할 서비스 추가를 클릭합니다.
  4. 역할 서비스 추가 마법사역할 서비스 선택 페이지에서 동적 압축 및 정적 콘텐츠 압축을 설치하려면 동적콘텐츠 압축을 선택하고 정적 압축을 설치하려면 다음을 클릭합니다.
    선택되고 강조 표시된 동적 콘텐츠 압축 옵션을 보여 주는 역할 서비스 선택 마법사의 스크린샷
  5. 설치 선택 확인 페이지에서 설치를 클릭합니다.
  6. Results(결과) 페이지에서 Close(닫기)를 클릭합니다.

Windows Vista 또는 Windows 7

  1. 작업 표시줄에서 시작을 클릭한 다음 제어판 클릭합니다.
  2. 제어판프로그램 및 기능을 클릭한 다음 Windows 기능 켜기 또는 끄기를 클릭합니다.
  3. 인터넷 정보 서비스, World Wide Web Services, 성능 기능을 차례로 확장합니다.
  4. 정적 압축을 설치하려는 경우 동적 압축 및 정적 콘텐츠 압축 을 설치하려면 Http 압축 동적을 선택합니다.
    선택되고 강조 표시된 H T TP 압축 동적 폴더의 스크린샷
  5. 확인을 클릭합니다.

방법

IIS 7에 대한 동적 콘텐츠 형식을 설정하기 위한 사용자 인터페이스가 없습니다. 동적 콘텐츠 형식을 프로그래밍 방식으로 설정하는 방법에 대한 예제는 이 문서의 코드 샘플 섹션을 참조하세요.

구성

특성

없음

자식 요소

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

동적 MIME 형식의 컬렉션에 MIME 형식을 추가합니다.
remove 선택적 요소입니다.

동적 MIME 형식 컬렉션에서 MIME 형식에 대한 참조를 제거합니다.
clear 선택적 요소입니다.

동적 MIME 형식 컬렉션에서 MIME 형식에 대한 모든 참조를 제거합니다.

구성 샘플

다음 기본 <httpCompression> 요소는 IIS 7의 ApplicationHost.config 파일에 구성됩니다. 이 구성 섹션에서는 요소를 사용하지 않는 한 기본 구성 설정을 상속합니다 <clear> .

<httpCompression
      directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
   <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
   <dynamicTypes>
      <add mimeType="text/*" enabled="true" />
      <add mimeType="message/*" enabled="true" />
      <add mimeType="application/javascript" enabled="true" />
      <add mimeType="*/*" enabled="false" />
   </dynamicTypes>
   <staticTypes>
      <add mimeType="text/*" enabled="true" />
      <add mimeType="message/*" enabled="true" />
      <add mimeType="application/javascript" enabled="true" />
      <add mimeType="*/*" enabled="false" />
   </staticTypes>
</httpCompression>

샘플 코드

다음 코드 샘플에서는 Office 2003 문서의 MIME 형식을 동적 압축 형식 목록에 추가합니다.

(> [! 참고]

Office 2007 문서는 기본 제공 압축을 사용하므로 IIS에서 압축할 필요가 없습니다.)

AppCmd.exe

appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/msword',enabled='True']" /commit:apphost

appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/vnd.ms-powerpoint',enabled='True']" /commit:apphost

appcmd.exe set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/vnd.ms-excel',enabled='True']" /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 httpCompressionSection = config.GetSection("system.webServer/httpCompression");
         ConfigurationElementCollection dynamicTypesCollection = httpCompressionSection.GetCollection("dynamicTypes");

         ConfigurationElement addElement = dynamicTypesCollection.CreateElement("add");
         addElement["mimeType"] = @"application/msword";
         addElement["enabled"] = true;
         dynamicTypesCollection.Add(addElement);

         ConfigurationElement addElement1 = dynamicTypesCollection.CreateElement("add");
         addElement1["mimeType"] = @"application/vnd.ms-powerpoint";
         addElement1["enabled"] = true;
         dynamicTypesCollection.Add(addElement1);

         ConfigurationElement addElement2 = dynamicTypesCollection.CreateElement("add");
         addElement2["mimeType"] = @"application/vnd.ms-excel";
         addElement2["enabled"] = true;
         dynamicTypesCollection.Add(addElement2);

         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 httpCompressionSection As ConfigurationSection = config.GetSection("system.webServer/httpCompression")
      Dim dynamicTypesCollection As ConfigurationElementCollection = httpCompressionSection.GetCollection("dynamicTypes")

      Dim addElement As ConfigurationElement = dynamicTypesCollection.CreateElement("add")
      addElement("mimeType") = "application/msword"
      addElement("enabled") = True
      dynamicTypesCollection.Add(addElement)

      Dim addElement1 As ConfigurationElement = dynamicTypesCollection.CreateElement("add")
      addElement1("mimeType") = "application/vnd.ms-powerpoint"
      addElement1("enabled") = True
      dynamicTypesCollection.Add(addElement1)

      Dim addElement2 As ConfigurationElement = dynamicTypesCollection.CreateElement("add")
      addElement2("mimeType") = "application/vnd.ms-excel"
      addElement2("enabled") = True
      dynamicTypesCollection.Add(addElement2)

      serverManager.CommitChanges()
   End Sub

End Module

JavaScript

var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
var httpCompressionSection = adminManager.GetAdminSection("system.webServer/httpCompression", "MACHINE/WEBROOT/APPHOST");
var dynamicTypesCollection = httpCompressionSection.ChildElements.Item("dynamicTypes").Collection;

var addElement = dynamicTypesCollection.CreateNewElement("add");
addElement.Properties.Item("mimeType").Value = "application/msword";
addElement.Properties.Item("enabled").Value = true;
dynamicTypesCollection.AddElement(addElement);

var addElement1 = dynamicTypesCollection.CreateNewElement("add");
addElement1.Properties.Item("mimeType").Value = "application/vnd.ms-powerpoint";
addElement1.Properties.Item("enabled").Value = true;
dynamicTypesCollection.AddElement(addElement1);

var addElement2 = dynamicTypesCollection.CreateNewElement("add");
addElement2.Properties.Item("mimeType").Value = "application/vnd.ms-excel";
addElement2.Properties.Item("enabled").Value = true;
dynamicTypesCollection.AddElement(addElement2);

adminManager.CommitChanges();

VBScript

Set adminManager = WScript.CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set httpCompressionSection = adminManager.GetAdminSection("system.webServer/httpCompression", "MACHINE/WEBROOT/APPHOST")
Set dynamicTypesCollection = httpCompressionSection.ChildElements.Item("dynamicTypes").Collection

Set addElement = dynamicTypesCollection.CreateNewElement("add")
addElement.Properties.Item("mimeType").Value = "application/msword"
addElement.Properties.Item("enabled").Value = True
dynamicTypesCollection.AddElement(addElement)

Set addElement1 = dynamicTypesCollection.CreateNewElement("add")
addElement1.Properties.Item("mimeType").Value = "application/vnd.ms-powerpoint"
addElement1.Properties.Item("enabled").Value = True
dynamicTypesCollection.AddElement(addElement1)

Set addElement2 = dynamicTypesCollection.CreateNewElement("add")
addElement2.Properties.Item("mimeType").Value = "application/vnd.ms-excel"
addElement2.Properties.Item("enabled").Value = True
dynamicTypesCollection.AddElement(addElement2)

adminManager.CommitChanges()