In this post, I will explain you how to log the Request/Response xml of the WCF service.
At the Client end, which is consuming the WCF service, in its config file, add the following nodes:
At the Client end, which is consuming the WCF service, in its config file, add the following nodes:
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel.MessageLogging" switchValue="Warning,ActivityTracing">
<listeners>
<add name="ServiceModelMessageLoggingListener">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="c:\WCFClientLogs.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelMessageLoggingListener"
traceOutputOptions="LogicalOperationStack,
DateTime, Timestamp,
ProcessId, ThreadId, Callstack">
<filter type="" />
</add>
</sharedListeners>
</system.diagnostics>
<system.serviceModel>
<behaviors configSource=".\Configuration\ServiceModeBehaviors.config" />
<bindings configSource=".\Configuration\ServiceModelBindings.config" />
<client configSource=".\Configuration\ServiceModelClient.config" />
<diagnostics wmiProviderEnabled="true" performanceCounters="All">
<messageLogging logEntireMessage="true" logMalformedMessages="true"
logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" />
<endToEndTracing propagateActivity="true" activityTracing="true"
messageFlowTracing="true" />
</diagnostics>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
</configuration>
This will log the information in the following location with name : C:\WCFClientLogs.svclog
No comments:
Post a Comment