共用方式為


Implementing Custom ASP.NET Health Monitoring Events and Providers

ASP.NET health monitoring provides administrators an easy way to monitor the health of an ASP.NET application and get detailed run-time information about ASP.NET resources. Health monitoring contains ready-to-use Web health monitoring events classes, known as Web events, and health-monitoring providers (listeners). Web events are responsible for packaging health event information. Providers listen for events and consume the event information, typically by logging the information or notifying an administrator. You connect a Web event to a provider (referred to as enabling the event) by making settings in the healthMonitoring section of the application's configuration file.

By default, some events are already captured in performance counters, captured in the event log, or sent to the ASP.NET tracing system. You can enable other events by mapping them to existing providers. For more information, see the "Consuming Web Events Using Event Providers" section in ASP.NET Health Monitoring Overview.

If none of the existing Web event or provider classes meet your needs, you can extend them.

Extensibility Options

You can customize ASP.NET health monitoring in the following ways.

Task Implementation Example

Create a custom Web event class.

Create a class that inherits from the WebBaseEvent and implements the Raise virtual method. To add custom data to a custom event, override the FormatCustomEventDetails method.

How to: Implement and Raise Custom ASP.NET Health Monitoring Events

Create a custom event provider to process a built-in or custom Web event.

Create a class that inherits from the WebEventProvider class (or one of the derived classes). If your provider performs logging, also inherit from the WebEventFormatter class.

How to: Implement the Health Monitoring Custom Provider Example

See Also

Tasks

Walkthrough: Listening for WMI Events in ASP.NET Health Monitoring

Concepts

ASP.NET Health Monitoring Overview
Extending ASP.NET Health Monitoring
Configuring ASP.NET Health Monitoring