Sdílet prostřednictvím


healthMonitoring Element (ASP.NET Settings Schema) 

Configures an application for health monitoring.

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

<healthMonitoring 
   Enabled="true|false"
   heartbeatInterval="time interval">
   <bufferModes>...</bufferModes>
   <providers>...</providers>
   <eventMappings>...</eventMappings>
   <profiles>...</profiles>
   <rules>...</rules>
</healthMonitoring>

Attributes and Elements

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

Attributes

Attribute Description

enabled

Required Boolean attribute.

Specifies whether health monitoring is enabled. If true, health monitoring is enabled.

heartbeatInterval

Required TimeSpan attribute.

Specifies the interval, in seconds, for how often the WebHeartbeatEvent event is raised.

The default value is "00:00:00", which indicates that no WebHeartbeatEvent event is raised.

Child Elements

Element Description

bufferModes

Optional element.

Defines the buffering capabilities for a provider.

eventMappings

Optional element.

Maps friendly event names to the related event types.

profiles

Optional element.

Defines a collection of parameter sets to use when configuring events.

providers

Optional element.

Defines the health monitoring providers that process events.

rules

Optional element.

Maps events to providers.

Parent Elements

Element Description

configuration

Specifies the required 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.

Remarks

This configuration section applies at the machine or application level.

Default Configuration

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

<healthMonitoring>
   <bufferModes>
       <add name="Critical Notification" maxBufferSize="100" maxFlushSize="20" 
            urgentFlushThreshold="1" regularFlushInterval="Infinite" urgentFlushInterval="00:01:00" 
            maxBufferThreads="1" />
       <add name="Notification" maxBufferSize="300" maxFlushSize="20" urgentFlushThreshold="1" 
            regularFlushInterval="Infinite" urgentFlushInterval="00:01:00" 
            maxBufferThreads="1" />
       <add name="Analysis" maxBufferSize="1000" maxFlushSize="100" urgentFlushThreshold="100" 
            regularFlushInterval="00:05:00" urgentFlushInterval="00:01:00" 
            maxBufferThreads="1" />
       <add name="Logging" maxBufferSize="1000" maxFlushSize="200" urgentFlushThreshold="800" 
            regularFlushInterval="00:30:00" urgentFlushInterval="00:05:00" 
            maxBufferThreads="1" />
   </bufferModes>

   <providers>
       <add name="EventLogProvider"
            type="System.Web.Management.EventLogWebEventProvider,
System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" />
       <add ConnectionStringName="LocalSqlServer" maxEventDetailsLength="1073741823" 
            buffer="false" bufferMode="Notification" name="SqlWebEventProvider"
            type="System.Web.Management.SqlWebEventProvider,
System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" />
       <add name="WmiWebEventProvider"
            type="System.Web.Management.WmiWebEventProvider,
System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" />
   </providers>

   <profiles>
       <add name="Default" minInstances="1" maxLimit="Infinite" minInterval="00:01:00" 
            custom="" />
       <add name="Critical" minInstances="1" maxLimit="Infinite" minInterval="00:00:00" 
            custom="" />
   </profiles>

   <rules>
       <add name="All Errors Default" eventName="All Errors" provider="EventLogProvider" 
            profile="Default" minInstances="1" maxLimit="Infinite" minInterval="00:01:00" 
            custom="" />
       <add name="Failure Audits Default" eventName="Failure Audits"
            provider="EventLogProvider" profile="Default" minInstances="1" maxLimit="Infinite" 
            minInterval="00:01:00" custom="" />
   </rules>

   <eventMappings>
       <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" />
    </eventMappings>
</healthMonitoring>

Example

The following code example shows how to configure an application to monitor health status.

<healthMonitoring Enabled="true" heartbeatInterval="00:00:00">
  <!-- Configure the providers -->
  <providers>
    <add name="SampleEventProvider" type="Samples.AspNet.SampleEventProvider,SampleEventProvider,
Version=0.0.0.0,Culture=neutral,PublicKeyToken=92029af6cf75bd7c,ProcessorArchitecture=Neutral"/>
  </providers>

  <!--  Configure the events -->
  <eventMappings>
    <add  name="SampleWebRequests" type="Samples.AspNet.SampleWebRequestEvent,SampleWebRequestEvent,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=f0c63b9a560d5e5a"/>
  </eventMappings>

  <!-- Define the rules -->
  <rules>
    <add name="Sample Web Requests"
      eventName="SampleWebRequests"
      provider="SampleEventProvider"
      profile="Default"
      minInterval="00:01:00" />

    <add name="Standard Web Requests"
      eventName="All Events"
      provider="SampleEventProvider"
      profile="Default"
      minInterval="00:01:00" />
  </rules>

</healthMonitoring>

Element Information

Configuration section handler

System.Web.Configuration.HealthMonitoringSection

Configuration member

System.Web.Configuration.SystemWebSectionGroup.HealthMonitoring

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

system.web Element (ASP.NET Settings Schema)
configuration Element (General Settings Schema)
bufferModes Element for healthMonitoring (ASP.NET Settings Schema)
eventMappings Element for healthMonitoring (ASP.NET Settings Schema)
profiles Element for healthMonitoring (ASP.NET Settings Schema)
providers Element for healthMonitoring (ASP.NET Settings Schema)
profiles Element for healthMonitoring (ASP.NET Settings Schema)
rules Element for healthMonitoring (ASP.NET Settings Schema)
System.Configuration
System.Web.Configuration
System.Web.Management

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 Health Monitoring System
ASP.NET Configuration Files
ASP.NET Configuration Settings
General Configuration Settings (ASP.NET)
ASP.NET Configuration API