healthMonitoring 的 eventMappings 的 add 元素(ASP.NET 设置架构)

更新:2007 年 11 月

指定事件的名称以及实现该事件的类。

此元素是 .NET Framework 2.0 版中的新元素。

<configuration> 元素
  system.web 元素(ASP.NET 设置架构)
    healthMonitoring 元素(ASP.NET 设置架构)
      healthMonitoring 的 eventMappings 元素(ASP.NET 设置架构)
        healthMonitoring 的 eventMappings 的 add 元素(ASP.NET 设置架构)

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

属性和元素

下面几部分描述了本节涉及的属性、子元素和父元素。

属性

属性

说明

name

必选的 String 属性。

指定运行状况事件的友好名称。

type

必选的 String 属性。

指定事件的完全限定类型。

startEventCode

可选的 Int32 属性。

指定事件代码标识符的起始范围。

默认值为 0。

endEventCode

可选的 Int32 属性。

指定事件代码标识符的结束范围。

默认值为 "Infinite"。

子元素

无。

父元素

元素

说明

configuration

指定公共语言运行库和 .NET Framework 应用程序所使用的每个配置文件中的根元素。

system.web

为 ASP.NET 配置节指定根元素。

healthMonitoring

针对运行状况监视配置应用程序。

eventMappings

将事件的友好名称映射到相关事件类型。

备注

add 元素可用于为事件源分配友好名称。然后可以在 healthMonitoring 节的 rules 元素中,使用这些名称将事件源(称为提供者)与相关的事件使用者关联。

默认配置

下面的默认 add 元素在 .NET Framework 版本 2.0 的根 Web.config 文件中配置。

<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>
  <add name="SampleWebEvent"
    type= "Samples.AspNet.System.Web.Management.SampleWebEvent,
    SampleWebEvent,Version=0.0.0.0, Culture=neutral, 
    PublicKeyToken=f0c63b9a560d5e5a"/>
</eventMappings>

元素信息

配置节处理程序

System.Web.Configuration.HealthMonitoringSection

配置成员

HealthMonitoringSection.EventMappings

可配置的位置

Machine.config

根级别的 Web.config

应用程序级别的 Web.config

要求

Microsoft Internet 信息服务 (IIS) 版本 5.0、5.1 或 6.0

.NET Framework 2.0 版

Microsoft Visual Studio 2005

请参见

任务

如何:锁定 ASP.NET 配置设置

概念

ASP.NET 配置概述

ASP.NET Web 服务器控件和浏览器功能

保证 ASP.NET 配置的安全

ASP.NET 配置方案

参考

healthMonitoring 元素(ASP.NET 设置架构)

healthMonitoring 的 eventMappings 元素(ASP.NET 设置架构)

healthMonitoring 的 eventMappings 的 remove 元素(ASP.NET 设置架构)

healthMonitoring 的 eventMappings 的 clear 元素(ASP.NET 设置架构)

System.Configuration

System.Web.Configuration

其他资源

ASP.NET 配置文件

ASP.NET 配置设置

常规配置设置 (ASP.NET)

ASP.NET 配置 API