WCF Monitoring with Application Insights
We released a new Application Insights Labs SDK specifically for monitoring WCF applications. Although Application Insights SDK for .NET Web Applications already supports HTTP-based WCF applications, it has never been optimized for WCF specifics. The Application Insights WCF SDK makes a great experience for monitoring those applications. It monitors all common WCF bindings, and provides exception monitoring, clear identification of operations, and selective monitoring.
Writing monitoring tools, you always have a choice of many layers from which you can collect telemetry. The common denominator for many IIS based applications is the HTTP modules layer. The HTTP module receives notifications about every HTTP request, no matter what technology is used to process this request – ASP.NET, MVC, Web API or WCF. It can even monitor non-.NET applications.
We heard a lot of feedback that the generic approach is not quite working for WCF applications. This feedback was so strong that one of Application Insights fan and big supporter, Tomas Restrepo, decided to build WCF monitoring support for himself. He missed several experiences that were not supported in the web SDK and also wanted to remove some limitations.
Now we are sharing the result of Tomas’s work: Application Insights SDK for WCF applications.
The Application Insights SDK for WCF applications provides a list of exciting features.
Instrumentation with any common WCF bindings
The limitation of only HTTP bindings is now removed with the Application Insights SDK for WCF telemetry. Now you can use any of the common WCF bindings, HTTP-based or not!
Now you are able to differentiate requests for a specific service operation without custom code. Instead of a generic url path, operation names for request telemetry are in the form, <Contract>.<Operation>., so you can map operations more easily to your code.
IErrorHandler extensibility point
With IErrorHandler implemented you can automatically track exceptions or faults thrown by the service in most scenarios.
By default, calls to any WCF service will send a request event to Application Insights.
To select services for monitoring, attach the [OperationTelemetry] method attribute to the contracts or implementations of the services you want to be monitored. If you use this attribute anywhere in your app, services that don’t have the attribute will not be monitored.
Add to your WCF project the prerelease Microsoft.ApplicationInsights.Wcf package from the Application Insights SDK Labs package source.
If you’re using the command line NuGet package manager:
> Install-Package "Microsoft.ApplicationInsights.Wcf" –Source "https://www.myget.org/F/applicationinsights-sdk-labs/" -Pre
If you’re using Visual Studio:
In Solution Explorer, right-click your project and choose Manage NuGet Packages. Then add https://www.myget.org/F/applicationinsights-sdk-labs/ to the package sources list.
Set the package source, check Include prerelease and install Microsoft.ApplicationInsights.Wcf.
Set the instrumentation key
Add the instrumentation key of your Application Insights resource to the ApplicationInsights.config file. You can also provide the instrumentation key through code or web config. That’s it!
We want to thank Tomas Restrepo for sharing Application Insights SDK for WCF applications with us and the community.
Please let us know…
For any issues or feature requests please visit the Application Insights SDK for WCF Telemetry repository.
We would love to hear your thoughts and opinions comparing the WCF-specific SDK versus the generic Web SDK. The Application Insights team is committed to providing quality tools for developers. We would greatly appreciate any feedback or new feature recommendations.
Source: Microsoft Azure News