针对运行状况监视配置应用程序。
此元素是 .NET Framework 2.0 版中的新元素。
??system.web 元素(ASP.NET 设置架构)
????healthMonitoring 元素(ASP.NET 设置架构)
<healthMonitoring Enabled="true|false" heartbeatInterval="time interval"> <bufferModes>...</bufferModes> <providers>...</providers> <eventMappings>...</eventMappings> <profiles>...</profiles> <rules>...</rules> </healthMonitoring>  | 
属性和元素
下面几部分描述了本节涉及的属性、子元素和父元素。
属性
| 属性 | 说明 | 
|---|---|
| 
               enabled  | 
            
               必选的 Boolean 属性。 指定是否启用运行状态监视功能。如果为 true,则启用运行状况监视功能。  | 
          
| 
               heartbeatInterval  | 
            
               必选的 TimeSpan 属性。 指定时间间隔,即引发  默认值为 "00:00:00",它表示不引发 WebHeartbeatEvent 事件。  | 
          
子元素
| 元素 | 说明 | 
|---|---|
| 
               bufferModes  | 
            
               可选的元素。 定义提供程序的缓冲功能。  | 
          
| 
               eventMappings  | 
            
               可选的元素。 将事件友好名称映射到相关的事件类型。  | 
          
| 
               profiles  | 
            
               可选的元素。 定义一个参数集的集合以在配置事件时使用。  | 
          
| 
               providers  | 
            
               可选的元素。 定义处理事件的运行状况监视功能提供程序。  | 
          
| 
               rules  | 
            
               可选的元素。 将事件映射到提供程序。  | 
          
父元素
| 元素 | 说明 | 
|---|---|
| 
               configuration  | 
            
               指定公共语言运行库和 .NET Framework 应用程序所使用的每个配置文件中均需要的根元素。  | 
          
| 
               system.web  | 
            
               为 ASP.NET 配置节指定根元素。  | 
          
备注
在计算机级别或应用程序级别应用此配置节。
默认配置
下面的默认 healthMonitoring 元素在 .NET Framework 版本 2.0 的根 Web.config 文件中配置。
| ? |  复制代码 | 
|---|---|
<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> | |
示例
下面的代码示例演示如何为运行状况监视配置应用程序。
| ? |  复制代码 | 
|---|---|
<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> | |
元素信息
| 
             配置节处理程序  | 
          
             
                | 
        
| 
             配置成员  | 
          
             
                | 
        
| 
             可配置的位置  | 
          
             Machine.config 根级别的 Web.config 应用程序级别的 Web.config  | 
        
| 
             要求  | 
          
             Microsoft Internet 信息服务 (IIS) 版本 5.0、5.1 或 6.0 .NET Framework 2.0 版 Microsoft Visual Studio 2005  | 
        
请参见
任务
参考
system.web 元素(ASP.NET 设置架构)configuration 元素(常规设置架构)
healthMonitoring 的 bufferModes 元素(ASP.NET 设置架构)
healthMonitoring 的 eventMappings 元素(ASP.NET 设置架构)
healthMonitoring 的 profiles 元素(ASP.NET 设置架构)
healthMonitoring 的 providers 元素(ASP.NET 设置架构)
healthMonitoring 的 profiles 元素(ASP.NET 设置架构)
healthMonitoring 的 rules 元素(ASP.NET 设置架构)
概念
其他资源
ASP.NET 配置设置
常规配置设置 (ASP.NET)