The application I am building exposes several WCF services (A, B). Internally, it consumes several other WCF services running on our internal network (X, Y).
Using WCF message logging, I wish to only log traffic between our services A, B and the external clients who call them.
No data between my services (A,B) and the backend services (X,Y) should be logged by WCF.
Filtering via system.serviceModel/diagnostics/messageLogging/filters was partially successful with:
<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>
This however fails to capture responses from our service, as SOAP responses do not contain text to filter on.
The WCF MessageLogTraceRecord does contain the SOAP Action, but I can not seem to construct 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 logging and end to end tracing are enabled with all options set to true. ActivityTracing and Warning level logging are enabled.
Try this
<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 action filter with the URL in MessageLogTraceRecord > Action
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With