Thursday, February 6, 2014

WCF Logging raw soap requests.

To troubleshoot a contract filter mismatch or other WCF fault message being thrown from  third party consumers, here is the web.config settings that will show the raw soap requests to inspect if the caller is using a malformed request. Please be aware that the first thing to do when troubleshooting a contract filter mismatch is to ensure the web reference is up to date and running. This message can be very deceiving such as if you are calling a web service from a web service, and the latter web service is not running or running on a different virtual etc.

Make sure the first section is contained within System.Servicemodel. As you can see I do not show the opening tag tag.
 
 <!-------- within the system.servicemodel element -------->
 <diagnostics>      
      <messageLogging
           logEntireMessage="true"
           logMalformedMessages="true"           
           logMessagesAtServiceLevel="false"
           logMessagesAtTransportLevel="true"
            maxSizeOfMessageToLog="65535000" 
      maxMessagesToLog="500" />
    </diagnostics>
  </system.serviceModel>
  <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>
    </sources>
    <sharedListeners>
      <add name="xml"
           type="System.Diagnostics.XmlWriterTraceListener"
           initializeData="C:\test\Traces.svclog" />
    </sharedListeners>
  </system.diagnostics>

No comments:

Post a Comment