Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF service operation name

Is there a way to configure App Insights to collect the operation name when monitoring a WCF service? All requests get lumped together by URL (which are just POSTs that end in .svc), so there is no easy way to determine which particular operation was called on the service.

Does there need to be a custom Telemetry Initializer that can somehow determine which operation was actually called and set a custom property? if so, how do you determine the current WCF operation name?

like image 471
BrettJ Avatar asked Dec 27 '15 17:12

BrettJ


People also ask

What is Operation contract in WCF?

An Operation Contract defines the method exposed to the client to exchange the information between the client and server. An Operation Contract describes what functionality is to be given to the client, such as addition, subtraction and so on.

What are the different types of operations supported in WCF?

WCF has five types of contracts: service contract, operation contract, data contract, message contract and fault contract.

What are WCF services?

Windows Communication Foundation (WCF) is a framework for building service-oriented applications. Using WCF, you can send data as asynchronous messages from one service endpoint to another. A service endpoint can be part of a continuously available service hosted by IIS, or it can be a service hosted in an application.

Is WCF SOAP service?

Normally, a WCF service will use SOAP, but if you build a REST service, clients will be accessing your service with a different architectural style (calls, serialization like JSON, etc.).


2 Answers

Another option for collecting data on WCF operations is to use the Microsoft.ApplicationInsights.Wcf Nuget package. You can read more about this here.

like image 179
Geoff Hardy Avatar answered Jan 01 '23 09:01

Geoff Hardy


Brett,

Operation name can be customized in two ways:

1) Using a custom telemetry initializer - that specifically sets operation name. For more information about telemetry initializers: Custom Telemetry Initializers

2) From sdk version 2-beta3, auto-generated request telemetry is accessible though HttpContext extension method:

System.Web.HttpContextExtension.GetRequestTelemetry

Once the request telemetry is retrieved, operation name associated with it can be changed.

Please let me know if this addressed your question.

Thanks, Karthik

like image 22
karthik tangirala Avatar answered Jan 01 '23 08:01

karthik tangirala