Search code examples
wcffiddler

WCF Call not showing in Fiddler2


I have a simple WCF Service with basicHttp binding. The service is hosted locally (Win7 laptop) in IIS7. I'm able to browse the service at: http://localhost/musicstore/musicstore.svc (port 80)

I've developed a simple windows form client app to call the service. It works fine but I'd really like to see the message call / response through Fiddler2. Fiddler2 will happily report traffic as I browse the web so I can't understand why it's not picking up this WCF call?

Is there another way to view the data on WCF calls. Maybe there's a Microsoft Tool?

The client config is:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>

    <client>
      <endpoint address="http://localhost/musicstore/musicstore.svc"
        binding="basicHttpBinding" bindingConfiguration="" contract="MusicStore.IMusicStore"
        name="BasicHttp" />
    </client>
  </system.serviceModel>
</configuration>

The service config is:

<services>
   <service behaviorConfiguration="MusicStoreBehavior" name="MusicStore">
    <endpoint address="" binding="basicHttpBinding" contract="IMusicStore">
     <identity>
      <dns value="localhost" />
     </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
   </service>
  </services>

Solution

  • The easiest way to see what WCF is doing is to turn WCF's own logging on. You can do this by editing your web.config and adding

    <system.diagnostics>
      <sources>
          <source name="System.ServiceModel.MessageLogging">
            <listeners>
                     <add name="messages"
                     type="System.Diagnostics.XmlWriterTraceListener"
                     initializeData="c:\logs\messages.svclog" />
              </listeners>
          </source>
        </sources>
    </system.diagnostics>
    
    <system.serviceModel>
      <diagnostics>
        <messageLogging 
             logEntireMessage="true" 
             logMalformedMessages="false"
             logMessagesAtServiceLevel="true" 
             logMessagesAtTransportLevel="false"
             maxMessagesToLog="3000"
             maxSizeOfMessageToLog="2000"/>
      </diagnostics>
    </system.serviceModel>
    

    MSDN has more detailed information on what you can configure. You can view the logs in the Service Trace Viewer.