Freigeben über


TraceSection Class [IIS 7 and higher]

Configures the ASP.NET code-tracing service.

Syntax

class TraceSection : ConfigurationSection

Methods

The following table lists the methods exposed by the TraceSection class.

Name

Description

GetAllowDefinition

(Inherited from ConfigurationSection.)

GetAllowLocation

(Inherited from ConfigurationSection.)

RevertToParent

(Inherited from ConfigurationSection.)

SetAllowDefinition

(Inherited from ConfigurationSection.)

SetAllowLocation

(Inherited from ConfigurationSection.)

Properties

The following table lists the properties exposed by the TraceSection class.

Name

Description

Enabled

An optional read/write boolean value. true if tracing is enabled for an ASP.NET application; otherwise, false. The default is false.

When tracing is enabled, you can view the logged errors with the Trace.axd viewer at the URL http://<servername>/<applicationroot>/trace.axd. You must set the Enabled property to true to use the viewer.

NoteNote:
Trace.axd is added to the <httpHandlers> section in the Applicationhost.config file by default.

LocalOnly

An optional read/write boolean value. true if the trace viewer (Trace.axd) is available only on the host Web server; false if the trace viewer is available from any computer. The default is true.

Location

(Inherited from ConfigurationSection.) A key property.

MostRecent

An optional read/write boolean value. true if the trace store continues to collect the most recent trace messages and begins to discard older trace messages when the limit specified in RequestLimit is reached; false if the trace store stops collecting trace messages when the number specified in RequestLimit is reached. The default is false.

NoteNote:
This property is new in the .NET Framework 2.0.

PageOutput

An optional read/write boolean value. true if tracing information is added to the bottom of each Web page; false if trace output is accessible through the trace utility only. The default is false.

NoteNote:
For more information about the ASP.NET trace viewer utility, see How to: View ASP.NET Trace Information with the Trace Viewer.

Path

(Inherited from ConfigurationSection.) A key property.

RequestLimit

An optional read/write sint32 value that specifies the number of trace requests, from 0 through 10000, to store on the server. The default is 10. If the limit is reached and the MostRecent property is false, tracing stops.

NoteNote:
Although integer values in the range 0 to 2147483647 are accepted for the RequestLimit property, if you specify a value greater than 10000, ASP.NET silently rounds it down to 10000.

SectionInformation

(Inherited from ConfigurationSection.)

TraceMode

An optional read/write sint32 value that specifies the order in which trace information is displayed. The possible values are listed later in the Remarks section.

WriteToDiagnosticsTrace

An optional read/write boolean value. true if ASP.NET trace messages are forwarded to the System.Diagnostics tracing infrastructure for listeners that are registered to display trace messages; otherwise, false. The default is false.

NoteNote:
This property is new in the .NET Framework 2.0.

Subclasses

This class contains no subclasses.

Remarks

The following table lists the possible values for the TraceMode property. The default is 1 (SortByTime).

Value

Keyword

Description

1

SortByTime

Specifies that trace information is displayed in the order that it is processed.

2

SortByCategory

Specifies that trace information is displayed alphabetically by user-defined categories specified in the TraceContextWarn()()()() and TraceContextWrite()()()() method calls in page or server control code.

Inheritance Hierarchy

ConfigurationSection

   TraceSection

Requirements

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

See Also

Reference

ConfigurationSection Class [IIS 7 and higher]

TraceContext

Other Resources

trace Element (ASP.NET Settings Schema)

How to: Enable Tracing for an ASP.NET Page

System.Web.TraceContext Methods