Enable WCF Tracing in your WCF web services for debugging or investigating on issues
If you are working with WCF web services, you should know about WCF tracing. WCF trace, is a wonderful built in feature come with .Net and it's a very powerful tool for debugging or investigating on issues related to the request or response, which send or receive by WCF web services.
Recently I used this feature for investigation on data type related issue in one of my web service request. It is a very handy tool. I'd like to share it with you. I'm pretty sure most of WCF developers have a very good understating about this feature but for who just started working with WCF or who is not familiar with this wonderful feature, it worth to have a quick look at this article.
Here is required configurations you need to add to your web config file.
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true" >
<listeners>
<add name="xml"/>
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add name="xml"/>
</listeners>
</source>
<source name="myUserTraceSource"
switchValue="Information, ActivityTracing">
<listeners>
<add name="xml"/>
</listeners>
</source>
</sources>
<sharedListeners>
<add name="xml"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="C:\logs\Traces.svclog" />
</sharedListeners>
</system.diagnostics>
<system.serviceModel>
<diagnostics wmiProviderEnabled="true">
<messageLogging
logEntireMessage="true"
logMalformedMessages="true"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="true"
maxMessagesToLog="3000"
/>
</diagnostics>
</system.serviceModel>
</configuration>
Link to MSDN article for more information:
https://msdn.microsoft.com/en-us/library/aa702726(v=vs.110).aspx
Enjoy it :)