Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF Call not showing in Fiddler2

Tags:

wcf

fiddler

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>
like image 503
Rob Bowman Avatar asked May 23 '11 16:05

Rob Bowman


3 Answers

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.

like image 180
blowdart Avatar answered Nov 10 '22 07:11

blowdart


There are many duplicates of this question, many of which have correct answers. You should use http://localhost.fiddler/ as the target and .NET will properly proxy the request. Fiddler will then change "localhost.fiddler" to "localhost" before passing on the request.

like image 43
EricLaw Avatar answered Nov 10 '22 07:11

EricLaw


You can modify your client's configfile:

<configuration>
  <system.net>
    <defaultProxy>
      <proxy bypassonlocal="false" usesystemdefault="true" />
    </defaultProxy>
  </system.net>
</configuration>

Or you could use:

GlobalProxySelection.Select = new WebProxy("127.0.0.1", 8888);

From: Fiddler site

like image 28
Dutch Nico Avatar answered Nov 10 '22 06:11

Dutch Nico