WCF服务操作名称 [英] WCF service operation name

查看:56
本文介绍了WCF服务操作名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在监视WCF服务时,是否可以将App Insights配置为收集操作名称?所有请求都由URL集中在一起(URL只是以.svc结尾的POST),因此没有简单的方法来确定在服务上调用了哪个特定操作.

是否需要一个自定义的遥测初始化程序,可以以某种方式确定实际调用了哪个操作并设置自定义属性?如果是这样,您如何确定当前的WCF操作名称?

解决方案

Brett,

可以通过两种方式自定义操作名称:

1)使用自定义遥测初始化程序-专门设置操作名称. 有关遥测初始化程序的更多信息:自定义遥测初始化程序

2)从sdk版本2-beta3开始,可以通过HttpContext扩展方法访问自动生成的请求遥测:

System.Web.HttpContextExtension.GetRequestTelemetry

一旦检索到请求遥测,就可以更改与其关联的操作名称.

请让我知道这是否解决了您的问题.

谢谢, 卡尔提克

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?

解决方案

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

这篇关于WCF服务操作名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆