추적 공급자 정의 <traceProviderDefinitions>

개요

요소를 <traceProviderDefinitions> 사용하면 IIS(인터넷 정보 서비스) 7 서버에서 사용할 수 있는 추적 공급자 컬렉션을 정의할 수 있습니다. 추적 공급자는 추적 메시지 또는 추적 이벤트를 생성하는 애플리케이션 또는 운영 체제 구성 요소입니다. IIS 7에 추적 역할 서비스를 설치하는 경우 기본적으로 IIS는 IIS 7 서버, ASP 추적 공급자 및 ISAPI 확장 추적 공급자와 연결된 WWW Server 추적 공급자를 설치합니다. 서버에 ASP.NET 2.0을 설치하는 경우 IIS 7은 ASPNET 추적 공급자를 추적 공급자 정의 컬렉션에 자동으로 추가합니다. IIS는 요소 내의 <add> 요소에서 각 추적 공급자를 <traceProviderDefinitions> 정의합니다.

해당 추적 공급자를 정의하는 요소를 추가하여 <add> 서버에 사용자 지정 추적 공급자를 추가할 수 있습니다. 요소에 <remove> 요소를 포함하면 구성 계층 구조의 <traceProviderDefinitions> 상위 구성 파일에서 상속된 단일 추적 공급자를 제거할 수 있습니다. 요소를 사용하여 <clear> 상속된 모든 추적 공급자를 제거할 수 있습니다.

호환성

버전 참고
IIS 10.0 <traceProviderDefinitions> 요소가 IIS 10.0에서 수정되지 않았습니다.
IIS 8.5 <traceProviderDefinitions> 요소가 IIS 8.5에서 수정되지 않았습니다.
IIS 8.0 <traceProviderDefinitions> 요소가 IIS 8.0에서 수정되지 않았습니다.
IIS 7.5 <traceProviderDefinitions> 요소가 IIS 7.5에서 수정되지 않았습니다.
IIS 7.0 요소는 <traceProviderDefinitions> IIS 7.0에서 도입되었습니다.
IIS 6.0 해당 없음

설치 프로그램

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를 확장한 다음 상태 및 진단을 확장한 다음 추적을 선택합니다.
    추적이 선택된 World Wide Web Services 및 상태 및 진단 노드의 스크린샷- 확인을 클릭합니다.
  4. 닫기를 클릭합니다.

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. 추적을 선택한 다음 확인을 클릭합니다.
    스크린샷은 추적이 강조 표시된 상태에서 확장된 World Wide Web Services 및 상태 및 진단 노드를 보여줍니다.

방법

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

구성

ApplicationHost.config 파일의 서버 수준 또는 적절한 Web.config 파일의 사이트 수준, 애플리케이션 수준 또는 디렉터리 수준에서 요소를 구성할 <traceProviderDefinitions> 수 있습니다.

특성

없음

자식 요소

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

추적 공급자의 컬렉션에 추적 공급자를 추가합니다.
clear 선택적 요소입니다.

추적 공급자 컬렉션에서 추적 공급자에 대한 모든 참조를 제거합니다.
remove 선택적 요소입니다.

추적 공급자 컬렉션에서 추적 공급자에 대한 참조를 제거합니다.

구성 샘플

다음 기본 <traceProviderDefinitions> 요소는 IIS 7.0의 루트 ApplicationHost.config 파일에 구성됩니다.

<traceProviderDefinitions>
   <add name="WWW Server" guid="{3a2a4e84-4c21-4981-ae10-3fda0d9b0f83}">
      <areas>
         <clear />
         <add name="Authentication" value="2" />
         <add name="Security" value="4" />
         <add name="Filter" value="8" />
         <add name="StaticFile" value="16" />
         <add name="CGI" value="32" />
         <add name="Compression" value="64" />
         <add name="Cache" value="128" />
         <add name="RequestNotifications" value="256" />
         <add name="Module" value="512" />
      </areas>
   </add>
   <add name="ASP" guid="{06b94d9a-b15e-456e-a4ef-37c984a2cb4b}">
      <areas>
         <clear />
      </areas>
   </add>
   <add name="ISAPI Extension" guid="{a1c2040e-8840-4c31-ba11-9871031a19ea}">
      <areas>
         <clear />
      </areas>
   </add>
   <add name="ASPNET" guid="{AFF081FE-0247-4275-9C4E-021F3DC1DA35}">
      <areas>
         <add name="Infrastructure" value="1" />
         <add name="Module" value="2" />
         <add name="Page" value="4" />
         <add name="AppServices" value="8" />
      </areas>
   </add>
</traceProviderDefinitions>

샘플 코드

다음 예제에서는 전역 <traceProviderDefinitions> 컬렉션에 정의된 목록에 두 개의 추적 영역이 있는 사용자 지정 추적 공급자를 추가합니다.

AppCmd.exe

appcmd.exe set config -section:system.webServer/tracing/traceProviderDefinitions /+"[name='MyTraceProvider',guid='{00000000-0000-0000-0000-00000000000}']" /commit:apphost

appcmd.exe set config -section:system.webServer/tracing/traceProviderDefinitions /+"[guid='{00000000-0000-0000-0000-00000000000}'].areas.[name='ProviderAreaOne',value='0']" /commit:apphost

appcmd.exe set config -section:system.webServer/tracing/traceProviderDefinitions /+"[guid='{00000000-0000-0000-0000-00000000000}'].areas.[name='ProviderAreaTwo',value='1']" /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 traceProviderDefinitionsSection = config.GetSection("system.webServer/tracing/traceProviderDefinitions");
         ConfigurationElementCollection traceProviderDefinitionsCollection = traceProviderDefinitionsSection.GetCollection();

         ConfigurationElement addElement = traceProviderDefinitionsCollection.CreateElement("add");
         addElement["name"] = @"MyTraceProvider";
         addElement["guid"] = @"{00000000-0000-0000-0000-00000000000}";
         ConfigurationElementCollection areasCollection = addElement.GetCollection("areas");

         ConfigurationElement addElement1 = areasCollection.CreateElement("add");
         addElement1["name"] = @"ProviderAreaOne";
         addElement1["value"] = 0;
         areasCollection.Add(addElement1);

         ConfigurationElement addElement2 = areasCollection.CreateElement("add");
         addElement2["name"] = @"ProviderAreaTwo";
         addElement2["value"] = 1;
         areasCollection.Add(addElement2);

         traceProviderDefinitionsCollection.Add(addElement);
         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 traceProviderDefinitionsSection As ConfigurationSection = config.GetSection("system.webServer/tracing/traceProviderDefinitions")
      Dim traceProviderDefinitionsCollection As ConfigurationElementCollection = traceProviderDefinitionsSection.GetCollection

      Dim addElement As ConfigurationElement = traceProviderDefinitionsCollection.CreateElement("add")
      addElement("name") = "MyTraceProvider"
      addElement("guid") = "{00000000-0000-0000-0000-00000000000}"
      Dim areasCollection As ConfigurationElementCollection = addElement.GetCollection("areas")

      Dim addElement1 As ConfigurationElement = areasCollection.CreateElement("add")
      addElement1("name") = "ProviderAreaOne"
      addElement1("value") = 0
      areasCollection.Add(addElement1)

      Dim addElement2 As ConfigurationElement = areasCollection.CreateElement("add")
      addElement2("name") = "ProviderAreaTwo"
      addElement2("value") = 1
      areasCollection.Add(addElement2)

      traceProviderDefinitionsCollection.Add(addElement)
      serverManager.CommitChanges()
   End Sub
End Module

JavaScript

var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
var traceProviderDefinitionsSection = adminManager.GetAdminSection("system.webServer/tracing/traceProviderDefinitions", "MACHINE/WEBROOT/APPHOST");
var traceProviderDefinitionsCollection = traceProviderDefinitionsSection.Collection;

var addElement = traceProviderDefinitionsCollection.CreateNewElement("add");
addElement.Properties.Item("name").Value = "MyTraceProvider";
addElement.Properties.Item("guid").Value = "{00000000-0000-0000-0000-00000000000}";
var areasCollection = addElement.ChildElements.Item("areas").Collection;

var addElement1 = areasCollection.CreateNewElement("add");
addElement1.Properties.Item("name").Value = "ProviderAreaOne";
addElement1.Properties.Item("value").Value = 0;
areasCollection.AddElement(addElement1);

var addElement2 = areasCollection.CreateNewElement("add");
addElement2.Properties.Item("name").Value = "ProviderAreaTwo";
addElement2.Properties.Item("value").Value = 1;
areasCollection.AddElement(addElement2);

traceProviderDefinitionsCollection.AddElement(addElement);
adminManager.CommitChanges();

VBScript

Set adminManager = createObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set traceProviderDefinitionsSection = adminManager.GetAdminSection("system.webServer/tracing/traceProviderDefinitions", "MACHINE/WEBROOT/APPHOST")
Set traceProviderDefinitionsCollection = traceProviderDefinitionsSection.Collection

Set addElement = traceProviderDefinitionsCollection.CreateNewElement("add")
addElement.Properties.Item("name").Value = "MyTraceProvider"
addElement.Properties.Item("guid").Value = "{00000000-0000-0000-0000-00000000000}"
Set areasCollection = addElement.ChildElements.Item("areas").Collection

Set addElement1 = areasCollection.CreateNewElement("add")
addElement1.Properties.Item("name").Value = "ProviderAreaOne"
addElement1.Properties.Item("value").Value = 0
areasCollection.AddElement addElement1

Set addElement2 = areasCollection.CreateNewElement("add")
addElement2.Properties.Item("name").Value = "ProviderAreaTwo"
addElement2.Properties.Item("value").Value = 1
areasCollection.AddElement addElement2

traceProviderDefinitionsCollection.AddElement addElement
adminManager.CommitChanges()