This project is read-only.

Instrument for significant business operations

J.D. Meier, Jason Taylor, Prashant Bansode, Carlos Farre, Madhu Sundararajan, Steve Gregersen.

Use ASP.NET Health Monitoring to Instrument your application to track access to sensitive operations. For, instance you could track usage of methods that relate to financial transactions or access to sensitive data.

Doing this helps you to detect and react to potentially suspicious behavior. It also enables you to gather operations data; for example, to track what business important operations are being carried out and by whom etc.

The following steps shows how to instrument your application with Health Monitoring
  1. Create a class library and a class that inherits from WebSuccessAuditEvent that displays some business information, such as bank account transactions.
using System.Web.Management;

public class MyAccountTransactions : WebSuccessAuditEvent

  public MyAccountTransactions(string msg, object eventSource, int eventCode)
            : base(msg, eventSource, eventCode)
	// Do some processing

 public MyAccountTransactions(string msg, object eventSource, int eventCode, int eventDetailCode)
            : base(msg, eventSource, eventCode, eventDetailCode)
	// Do some processing
 public override void FormatCustomEventDetails(WebEventFormatter formatter)

     // Display some transaction information
    formatter.AppendLine("Some Credit\Debit information");
  1. Configure your WCF Service for Health Monitoring
			<add name="SomeTransactionInfo" type="MyEventLibrary.MyAccountTransactions, MyEventLibrary"/>
			<add name="Custom event" eventName="SomeTransactionInfo" provider="EventLogProvider" minInterval="00:00:01"/>
  1. Instrument the WCF Service by raising the custom event in a service contract.
public string InvokeBusinessEvent()
    MyAccountTransactions obj = new MyAccountTransactions("Invoking some business operation", this, WebEventCodes.WebExtendedBase + 1);
    return "Displaying some transaction details";
  1. Verify the Service Events in the Event Log after calling the service method from a Test client.

Last edited Apr 24, 2008 at 12:14 AM by prashantbansode, version 2


No comments yet.