TraceSection 클래스

정의

ASP.NET 추적 서비스를 구성합니다. 이 클래스는 상속될 수 없습니다.

public ref class TraceSection sealed : System::Configuration::ConfigurationSection
public sealed class TraceSection : System.Configuration.ConfigurationSection
type TraceSection = class
    inherit ConfigurationSection
Public NotInheritable Class TraceSection
Inherits ConfigurationSection
상속

예제

다음 코드 예제를 사용 하는 방법을 보여 줍니다는 TraceSection 형식입니다.

using System;
using System.Collections;
using System.Collections.Specialized;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Configuration;
using System.Web.Configuration;

namespace Samples.Aspnet.SystemWebConfiguration
{
    // Accesses the System.Web.Configuration.TraceSection members
    // selected by the user.
    class UsingTraceSection
    {
        public static void Main()
        {
            // Process the System.Web.Configuration.TraceSectionobject.
            try
            {
                // Get the Web application configuration.
                System.Configuration.Configuration configuration = 
                    System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/aspnet");
                
                // Get the section.
                System.Web.Configuration.TraceSection traceSection = 
                    (System.Web.Configuration.TraceSection) 
                    configuration.GetSection("system.web/trace");

// Get the current PageOutput property value.
Boolean pageOutputValue = traceSection.PageOutput;

// Set the PageOutput property to true.
traceSection.PageOutput = true;

                

// Get the current WriteToDiagnosticsTrace property value.
Boolean writeToDiagnosticsTraceValue = traceSection.WriteToDiagnosticsTrace;

// Set the WriteToDiagnosticsTrace property to true.
traceSection.WriteToDiagnosticsTrace = true;

                

// Get the current MostRecent property value.
Boolean mostRecentValue = traceSection.MostRecent;

// Set the MostRecent property to true.
traceSection.MostRecent = true;

                

// Get the current RequestLimit property value.
Int32 requestLimitValue = traceSection.RequestLimit;

// Set the RequestLimit property to 256.
traceSection.RequestLimit = 256;

                

// Get the current LocalOnly property value.
Boolean localOnlyValue = traceSection.LocalOnly;

// Set the LocalOnly property to false.
traceSection.LocalOnly = false;

                

// Get the current Enabled property value.
Boolean enabledValue = traceSection.Enabled;

// Set the Enabled property to false.
traceSection.Enabled = false;

                

// Get the current Mode property value.
// TraceDisplayMode modeValue = traceSection.TraceMode;

// Set the Mode property to TraceDisplayMode.SortyByTime.
// traceSection.Mode = TraceDisplayMode.SortByTime;

                
                // Update if not locked.
                if (! traceSection.SectionInformation.IsLocked)
                {
                    configuration.Save();
                    Console.WriteLine("** Configuration updated.");
                }
                else
                {
                    Console.WriteLine("** Could not update, section is locked.");
                }
            }
            catch (System.ArgumentException e)
            {
                // Unknown error.
                Console.WriteLine(
                    "A invalid argument exception detected in UsingTraceSection Main. Check your");
                Console.WriteLine("command line for errors.");
            }
        }
    } // UsingTraceSection class end.
} // Samples.Aspnet.SystemWebConfiguration namespace end.
Imports System.Collections
Imports System.Collections.Specialized
Imports System.IO
Imports System.Text
Imports System.Text.RegularExpressions
Imports System.Configuration
Imports System.Web.Configuration

Namespace Samples.Aspnet.SystemWebConfiguration
    ' Accesses the System.Web.Configuration.TraceSection members
    ' selected by the user.
    Class UsingTraceSection
        Public Shared Sub Main()
            ' Process the System.Web.Configuration.TraceSectionobject.
            Try
                ' Get the Web application configuration.
                Dim configuration As System.Configuration.Configuration = _
                    System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/aspnet")

                ' Get the section.
                Dim traceSection As System.Web.Configuration.TraceSection = _
                    CType(configuration.GetSection("system.web/trace"), _
                    System.Web.Configuration.TraceSection)

                ' Get the current PageOutput property value.
                Dim pageOutputValue As Boolean = traceSection.PageOutput

                ' Set the PageOutput property to true.
                traceSection.PageOutput = True



                ' Get the current WriteToDiagnosticsTrace property value.
                Dim writeToDiagnosticsTraceValue As Boolean = traceSection.WriteToDiagnosticsTrace

                ' Set the WriteToDiagnosticsTrace property to true.
                traceSection.WriteToDiagnosticsTrace = True



                ' Get the current MostRecent property value.
                Dim mostRecentValue As Boolean = traceSection.MostRecent

                ' Set the MostRecent property to true.
                traceSection.MostRecent = True



                ' Get the current RequestLimit property value.
                Dim requestLimitValue As Int32 = traceSection.RequestLimit

                ' Set the RequestLimit property to 256.
                traceSection.RequestLimit = 256



                ' Get the current LocalOnly property value.
                Dim localOnlyValue As Boolean = traceSection.LocalOnly

                ' Set the LocalOnly property to false.
                traceSection.LocalOnly = False



                ' Get the current Enabled property value.
                Dim enabledValue As Boolean = traceSection.Enabled

                ' Set the Enabled property to false.
                traceSection.Enabled = False



                ' Get the current Mode property value.
                'Dim modeValue As TraceDisplayMode = traceSection.TraceMode

                ' Set the Mode property to TraceDisplayMode.SortByTime.
                'traceSection.Mode = TraceDisplayMode.SortByTime


                ' Update if not locked.
                If Not traceSection.SectionInformation.IsLocked Then
                    configuration.Save()
                    Console.WriteLine("** Configuration updated.")
                Else
                    Console.WriteLine("** Could not update, section is locked.")
                End If
            Catch e As System.ArgumentException
                ' Unknown error.
                Console.WriteLine( _
                    "A invalid argument exception detected in UsingTraceSection Main. Check your")
                Console.WriteLine("command line for errors.")
            End Try
        End Sub
    End Class
    
End Namespace ' Samples.Aspnet.SystemWebConfiguration

설명

합니다 TraceSection 클래스는 프로그래밍 방식으로 액세스 하 고 구성 파일의 콘텐츠를 수정 하는 방법을 제공 trace 섹션입니다. 이 섹션에서는 trace ASP.NET 추적 기능을 구성하고 추적 결과를 수집, 저장 및 표시하는 방법을 제어합니다.

추적을 사용 하는 경우 각 페이지 요청 페이지 출력에 추가 되거나 애플리케이션 추적 로그에 저장 될 수 있는 추적 메시지를 생성 합니다. 추적 로그의 내용을 보려면 ASP.NET 추적 뷰어 (Trace.axd)를 사용할 수 있습니다.

생성자

TraceSection()

기본 설정을 사용하여 TraceSection 클래스의 새 인스턴스를 초기화합니다.

속성

CurrentConfiguration

현재 Configuration 인스턴스가 속해 있는 구성 계층 구조를 나타내는 최상위 ConfigurationElement 인스턴스에 대한 참조를 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
ElementInformation

ElementInformation 개체의 사용자 지정할 수 없는 정보와 기능을 포함하는 ConfigurationElement 개체를 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
ElementProperty

ConfigurationElementProperty 개체 자체를 나타내는 ConfigurationElement 개체를 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
Enabled

ASP.NET 추적 서비스를 사용할 수 있는지 여부를 나타내는 값을 가져오거나 설정합니다.

EvaluationContext

ContextInformation 개체의 ConfigurationElement 개체를 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
HasContext

CurrentConfiguration 속성이 null인지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
Item[ConfigurationProperty]

이 구성 요소의 속성이나 특성을 가져오거나 설정합니다.

(다음에서 상속됨 ConfigurationElement)
Item[String]

이 구성 요소의 속성, 특성 또는 자식 요소를 가져오거나 설정합니다.

(다음에서 상속됨 ConfigurationElement)
LocalOnly

호스트 웹 서버의 요청에 대해서만 ASP.NET 추적 뷰어(Trace.axd)를 사용할 수 있는지 여부를 나타내는 값을 가져오거나 설정합니다.

LockAllAttributesExcept

잠긴 특성의 컬렉션을 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
LockAllElementsExcept

잠긴 요소의 컬렉션을 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
LockAttributes

잠긴 특성의 컬렉션을 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
LockElements

잠긴 요소의 컬렉션을 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
LockItem

요소가 잠겨 있는지 여부를 나타내는 값을 가져오거나 설정합니다.

(다음에서 상속됨 ConfigurationElement)
MostRecent

최근 요청이 서버에 항상 저장되는지 여부를 나타내는 값을 가져오거나 설정합니다.

PageOutput

ASP.NET 추적 정보가 각 페이지 출력에 추가되는지 여부를 나타내는 값을 가져오거나 설정합니다.

Properties

속성 컬렉션을 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
RequestLimit

ASP.NET에서 추적 정보를 저장하는 애플리케이션에 대한 최대 요청 수를 나타내는 값을 가져오거나 설정합니다.

SectionInformation

사용자가 지정할 수 없는 SectionInformation 개체의 정보와 기능을 포함하는 ConfigurationSection 개체를 가져옵니다.

(다음에서 상속됨 ConfigurationSection)
TraceMode

ASP.NET 추적 정보가 표시되는 순서를 가져오거나 설정합니다.

WriteToDiagnosticsTrace

페이지 추적을 통해 생성된 메시지가 Trace 클래스의 인스턴스에 전달되는지 여부를 나타내는 값을 가져오거나 설정합니다.

메서드

DeserializeElement(XmlReader, Boolean)

구성 파일에서 XML을 읽습니다.

(다음에서 상속됨 ConfigurationElement)
DeserializeSection(XmlReader)

구성 파일에서 XML을 읽습니다.

(다음에서 상속됨 ConfigurationSection)
Equals(Object)

현재 ConfigurationElement 인스턴스를 지정된 개체와 비교합니다.

(다음에서 상속됨 ConfigurationElement)
GetHashCode()

현재 ConfigurationElement 인스턴스를 나타내는 고유 값을 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
GetRuntimeObject()

파생 클래스에서 재정의될 때 사용자 지정 개체를 반환합니다.

(다음에서 상속됨 ConfigurationSection)
GetTransformedAssemblyString(String)

지정된 어셈블리 이름의 변환된 버전을 반환합니다.

(다음에서 상속됨 ConfigurationElement)
GetTransformedTypeString(String)

지정된 형식 이름의 변환된 버전을 반환합니다.

(다음에서 상속됨 ConfigurationElement)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
Init()

ConfigurationElement 개체를 초기 상태로 설정합니다.

(다음에서 상속됨 ConfigurationElement)
InitializeDefault()

ConfigurationElement 개체 값의 기본 집합을 초기화하는 데 사용됩니다.

(다음에서 상속됨 ConfigurationElement)
IsModified()

이 구성 요소가 파생 클래스에서 구현되었을 때 마지막으로 저장되거나 로드된 이후 수정되었는지 여부를 나타냅니다.

(다음에서 상속됨 ConfigurationSection)
IsReadOnly()

ConfigurationElement 개체가 읽기 전용인지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
ListErrors(IList)

ConfigurationElement 개체와 모든 하위 요소의 잘못된 속성 오류를 전달된 목록에 추가합니다.

(다음에서 상속됨 ConfigurationElement)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
OnDeserializeUnrecognizedAttribute(String, String)

역직렬화하는 동안 알 수 없는 특성을 발견했는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
OnDeserializeUnrecognizedElement(String, XmlReader)

역직렬화하는 동안 알 수 없는 요소를 발견했는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 ConfigurationElement)
OnRequiredPropertyNotFound(String)

필수 속성이 없으면 예외를 throw합니다.

(다음에서 상속됨 ConfigurationElement)
PostDeserialize()

deserialization 후에 호출됩니다.

(다음에서 상속됨 ConfigurationElement)
PreSerialize(XmlWriter)

serialization 전에 호출됩니다.

(다음에서 상속됨 ConfigurationElement)
Reset(ConfigurationElement)

잠금 및 속성 컬렉션을 비롯하여 ConfigurationElement 개체의 내부 상태를 다시 설정합니다.

(다음에서 상속됨 ConfigurationElement)
ResetModified()

파생 클래스에서 구현되는 경우 IsModified() 메서드의 값을 false로 다시 설정합니다.

(다음에서 상속됨 ConfigurationSection)
SerializeElement(XmlWriter, Boolean)

파생 클래스에서 구현될 때 구성 요소의 내용을 구성 파일에 씁니다.

(다음에서 상속됨 ConfigurationElement)
SerializeSection(ConfigurationElement, String, ConfigurationSaveMode)

ConfigurationSection 개체의 병합되지 않은 뷰가 들어 있는 XML 문자열을 파일에 쓸 단일 섹션으로 만듭니다.

(다음에서 상속됨 ConfigurationSection)
SerializeToXmlElement(XmlWriter, String)

파생 클래스에서 구현될 때 구성 요소의 외부 태그를 구성 파일에 씁니다.

(다음에서 상속됨 ConfigurationElement)
SetPropertyValue(ConfigurationProperty, Object, Boolean)

속성을 지정된 값으로 설정합니다.

(다음에서 상속됨 ConfigurationElement)
SetReadOnly()

IsReadOnly() 개체와 모든 하위 요소에 대한 ConfigurationElement 속성을 설정합니다.

(다음에서 상속됨 ConfigurationElement)
ShouldSerializeElementInTargetVersion(ConfigurationElement, String, FrameworkName)

구성 개체 계층이 .NET Framework 지정된 대상 버전에 대해 직렬화될 때 지정된 요소를 serialize해야 하는지 여부를 나타냅니다.

(다음에서 상속됨 ConfigurationSection)
ShouldSerializePropertyInTargetVersion(ConfigurationProperty, String, FrameworkName, ConfigurationElement)

구성 개체 계층이 .NET Framework 지정된 대상 버전에 대해 serialize될 때 지정된 속성을 serialize해야 하는지 여부를 나타냅니다.

(다음에서 상속됨 ConfigurationSection)
ShouldSerializeSectionInTargetVersion(FrameworkName)

구성 개체 계층 구조가 지정된 대상 버전의 .NET Framework 직렬화될 때 현재 ConfigurationSection 인스턴스를 serialize해야 하는지 여부를 나타냅니다.

(다음에서 상속됨 ConfigurationSection)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)
Unmerge(ConfigurationElement, ConfigurationElement, ConfigurationSaveMode)

ConfigurationElement 개체를 수정하여 저장되지 않아야 하는 값을 모두 제거합니다.

(다음에서 상속됨 ConfigurationElement)

적용 대상

추가 정보