[wcf] How to use Fiddler to monitor WCF service

Consolidating the caveats mentioned in comments/answers for several use cases.

Mostly, see http://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/ConfigureDotNETApp

  • Start Fiddler before your app
  • In a console app, you might not need to specify the proxyaddress:

    <proxy bypassonlocal="False" usesystemdefault="True" />
    
  • In a web application / something hosted in IIS, you need to add the proxyaddress:

    <proxy bypassonlocal="False" usesystemdefault="True" proxyaddress="http://127.0.0.1:8888" />
    
  • When .NET makes a request (through a service client or HttpWebRequest, etc) it will always bypass the Fiddler proxy for URLs containing localhost, so you must use an alias like the machine name or make up something in your 'hosts' file (which is why something like localhost.fiddler or http://HOSTNAME works)
  • If you specify the proxyaddress, you must remove it from your config if Fiddler isn't on, or any requests your app makes will throw an exception like:

    No connection could be made because the target machine actively refused it 127.0.0.1:8888

  • Don't forget to use config transformations to remove the proxy section in production