WCF.Instrumentation 1.0.0

Instrumentation is provided using the event provider model. Events are notifications which you receive from the WCF application which can be a security event like password change, UI click events, or exception events like application level errors. These events are captured by the provider and routed to some source like event viewer, SQL Server, etc.

Install-Package WCF.Instrumentation -Version 1.0.0
dotnet add package WCF.Instrumentation --version 1.0.0
<PackageReference Include="WCF.Instrumentation" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WCF.Instrumentation --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Release Notes

How to implement:

In your service contract implement the health audit functionality

 [ServiceContract]
   public interface IService
   {
       [OperationContract]
       string Audit();
   }

In the Service.svc.cs class, implement the Audit function by creating the CustomAudit object and calling the Raise function

public class Service : IService
{
   public string Audit()
   {
       Healthmonitering.CustomAudit webevent =
                               new Healthmonitering.CustomAudit("Some on called",
                   this, WebEventCodes.WebExtendedBase + 1);
       webevent.Raise();
       return "Event Audited";
   }
}

In the web.config and under system.web element, add a healthmonitoring tag.
Specify CustomAudit class in the eventMappings element and mapping of the class with event viewer in the rules element tag

<healthMonitoring>
<eventMappings>
<add name="healthmonitering" type="Healthmonitering.CustomAudit "/>
</eventMappings>
<rules>
<add name="healthmonitering" eventName="healthmonitering"
               provider="EventLogProvider" minInterval="00:00:01"/>
</rules>
</healthMonitoring>


Finally, consume the client service and call the Audit function in the button click event

protected void Button_Click(object sender, EventArgs e)
{
   ServiceReference1.Service1Client proxy =
                               new WebApplication1.ServiceReference1.Service1Client();
   string result = proxy.Audit();
   Response.Write(result);
}

End result will be captured in the event logs like:

***************start health monitoring event*******************
message created at:Event Created at :3/23/2015 11:32:37 AM
message raised at:Event Created at :3/23/2015 11:32:37 AM
Heap size 2584335
Number of threads 14
Number of Working sets 32165888
Number of domains 1
Request rejected 0
******************End Health Monitoring event*********************

Dependencies

This package has no dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.0 622 3/23/2015