Partager via


add Element for eventMappings for healthMonitoring (ASP.NET Settings Schema) 

Specifies the name of the event and the class that implements it.

This element is new in the .NET Framework version 2.0.

<add
    name="health event name"
    type="type reference"
    startEventCode="starting event code range"
    endEventCode="ending event code range" />

Attributes and Elements

The following sections describe attributes, child elements, and parent elements for this section.

Attributes

Attribute Description

name

Required String attribute.

Specifies the friendly name of the health event.

type

Required String attribute.

Specifies the fully-qualified type of the event.

startEventCode

Optional Int32 attribute.

Specifies the starting event code identifier range.

The default is 0.

endEventCode

Optional Int32 attribute.

Specifies the ending event code identifier range.

The default is "Infinite".

Child Elements

None.

Parent Elements

Element Description

configuration

Specifies the root element in every configuration file that is used by the common language runtime and the .NET Framework applications.

system.web

Specifies the root element for the ASP.NET configuration section.

healthMonitoring

Configures an application for health monitoring.

eventMappings

Maps friendly event names to the related event types.

Remarks

The add element lets you assign friendly names to event sources. These names are then used to associate event sources with the related event consumers, called providers, in the rules element of the healthMonitoring section.

Default Configuration

The following default add element is configured in the root Web.config file in the .NET Framework version 2.0.

<add name="All Events" type="System.Web.Management.WebBaseEvent,System.Web,Version=2.0.0.0,
     Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" 
     endEventCode="2147483647" />
<add name="Heartbeats" type="System.Web.Management.WebHeartbeatEvent,System.Web,Version=2.0.0.0,
     Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" 
     endEventCode="2147483647" />
<add name="Application Lifetime Events" type="System.Web.Management.WebApplicationLifetimeEvent,
System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" 
     startEventCode="0" endEventCode="2147483647" />
<add name="Request Processing Events" type="System.Web.Management.WebRequestEvent,
System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" 
     endEventCode="2147483647" />
<add name="All Errors" type="System.Web.Management.WebBaseErrorEvent,System.Web,Version=2.0.0.0,
     Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" 
     endEventCode="2147483647" />
<add name="Infrastructure Errors" type="System.Web.Management.WebErrorEvent,System.Web,Version=2.0.0.0,
     Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" 
     endEventCode="2147483647" />
<add name="Request Processing Errors" type="System.Web.Management.WebRequestErrorEvent,
System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" 
     endEventCode="2147483647" />
<add name="All Audits" type="System.Web.Management.WebAuditEvent,System.Web,Version=2.0.0.0,
     Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" 
     endEventCode="2147483647" />
<add name="Failure Audits" type="System.Web.Management.WebFailureAuditEvent,System.Web,Version=2.0.0.0,
     Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" 
     endEventCode="2147483647" />
<add name="Success Audits" type="System.Web.Management.WebSuccessAuditEvent,System.Web,Version=2.0.0.0,
     Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" startEventCode="0" 
     endEventCode="2147483647" />

Example

The following code example shows how to add an event to the collection.

<eventMappings>
  <add name="SampleWebEvent"
    type= "Samples.AspNet.System.Web.Management.SampleWebEvent,
    SampleWebEvent,Version=0.0.0.0, Culture=neutral, 
    PublicKeyToken=f0c63b9a560d5e5a"/>
</eventMappings>

Element Information

Configuration section handler

System.Web.Configuration.HealthMonitoringSection

Configuration member

System.Web.Configuration.HealthMonitoringSection.EventMappings

Configurable locations

Machine.config

Root-level Web.config

Application-level Web.config

Requirements

Microsoft Internet Information Services (IIS) version 5.0, 5.1, or 6.0

The .NET Framework version 2.0

Microsoft Visual Studio 2005

See Also

Tasks

How to: Lock ASP.NET Configuration Settings

Reference

healthMonitoring Element (ASP.NET Settings Schema)
eventMappings Element for healthMonitoring (ASP.NET Settings Schema)
remove Element for eventMappings for healthMonitoring (ASP.NET Settings Schema)
clear Element for eventMappings for healthMonitoring (ASP.NET Settings Schema)
System.Configuration
System.Web.Configuration

Concepts

ASP.NET Configuration Overview
ASP.NET Web Server Controls and Browser Capabilities
Securing ASP.NET Configuration
ASP.NET Configuration Scenarios

Other Resources

ASP.NET Configuration Files
ASP.NET Configuration Settings
General Configuration Settings (ASP.NET)
ASP.NET Configuration API