The Tracing feature in WCF gives us the ability capture event\message details as calls are made to web services. Enabling this in IIS can be done fairly easily by selecting the Application and clicking the “Configure…” link in the Manage WCF and WF Services section of the Action panel. From there, go the Monitoring section which will allow you to configure your trace settings. You can also configure this at the website or server level as well.

You can also set this up in your application’s web.config (helpful when running under IIS Express) by adding diagnostic elements to the system.serviceModel and system.webServer sections.

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>   
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
                               multipleSiteBindingsEnabled="true" />
    <diagnostics>
      <messageLogging
        logEntireMessage="true"
        logMalformedMessages="true"
        logMessagesAtServiceLevel="true"
        logMessagesAtTransportLevel="true"
        maxMessagesToLog="100000">
      </messageLogging>
    </diagnostics>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="true"/>
  </system.webServer>
  <system.diagnostics>
    <sharedListeners>
      <add name="SharedServiceListener"
           type="System.Diagnostics.XmlWriterTraceListener"
           initializeData="C:\Temp\ServiceTraceLog.svclog"></add>
    </sharedListeners>
    <sources>
      <source name="System.ServiceModel" switchValue="Verbose">
        <listeners>
          <add name="SharedServiceListener"></add>
        </listeners>
      </source>
      <source name="System.ServiceModel.MessageLogging" switchValue="Verbose">
        <listeners>
          <add name="SharedServiceListener"></add>
        </listeners>
      </source>
    </sources>
  </system.diagnostics>
</configuration>