Ignore specific WCF services from WCF trace logs

The application I create provides several WCF services (A, B). Internally, it consumes several other WCF services running on our internal network (X, Y).

Using the WCF message log, I only want log traffic between our services A, B and the external clients that call them.

No data between my services (A, B) and backend services (X, Y) should be logged by WCF.

Filtering through system.serviceModel / diagnostics / messageLogging / filters was partially successful:

<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> 

However, this does not allow us to receive answers from our service, since SOAP responses do not contain text to filter.

WCF MessageLogTraceRecord contains a SOAP action, but I cannot create a filter to access it:

 <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> ... 

WCF message logs and end-to-end tracing are enabled with all options set to true. ActivityTracing logging and alerts enabled.

+6
source share
1 answer

try it

 <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> 

Replaced the text "MyServiceA" in the action filter with the URL in MessageLogTraceRecord> Action

+2
source

Source: https://habr.com/ru/post/913597/


All Articles