gpt4 book ai didi

wcf - 忽略 WCF 跟踪日志中的某些 WCF 服务

转载 作者:行者123 更新时间:2023-12-02 04:36:44 27 4
gpt4 key购买 nike

我正在构建的应用程序公开了多个 WCF 服务(A、B)。在内部,它消耗了在我们的内部网络(X、Y)上运行的其他几个 WCF 服务。

使用 WCF 消息日志记录,我希望记录我们的服务 A、B 与调用它们的外部客户端之间的流量。

WCF 不应记录我的服务 (A,B) 和后端服务 (X,Y) 之间的数据。

通过 system.serviceModel/diagnostics/messageLogging/filters 进行过滤部分成功:

    <filters>
<add nodeQuota="10" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
/s:Envelope/s:Header/*[contains(text(),"MyServiceA")]
</add>
<add nodeQuota="10" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">
/s:Envelope/s:Header/a:Action[contains(text(),"MyServiceA")]
</add>
</filters>

但是,这无法捕获来 self 们服务的响应,因为 SOAP 响应不包含要过滤的文本。

WCF MessageLogTraceRecord 确实包含 SOAP 操作,但我似乎无法构造一个过滤器来访问它:

<MessageLogTraceRecord>
<Addressing xmlns="http://schemas.microsoft.com/2004/06/ServiceModel/Management/MessageTrace>
<Action>http://opia.api.translink.com.au/ApiLocationService/2012/04/IApiLocationService/ResolveInputServiceFaultFault</Action>
</Addressing>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
...

在所有选项设置为 true 的情况下启用 WCF 消息记录和端到端跟踪。 ActivityTracing 和警告级别日志记录已启用。

最佳答案

试试这个

<filters>
<add nodeQuota="10" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
/s:Envelope/s:Header/*[contains(text(),"MyServiceA")]
</add>
<add nodeQuota="10" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">
/s:Envelope/s:Header/a:Action[contains(text(),"http://opia.api.translink.com.au/ApiLocationService/2012/04/IApiLocationService/ResolveInputServiceFaultFault")]
</add>
</filters>

将操作过滤器中的文本“MyServiceA”替换为 MessageLogTraceRecord > 操作中的 URL

关于wcf - 忽略 WCF 跟踪日志中的某些 WCF 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10222127/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com