How Intercept HTTP calls from WCF client to service

February 12, 2015 by Anuraj

.Net .Net 4.0 ASP.Net Visual Studio WCF

Today I faced some problem, I had to intercept HTTP calls from WCF proxy to WCF service. I was using Fiddler 4. But unfortunely it was not working :( I tried many options.(It was not working for me, but it may work for you)

  1. By using proxy setting - In the clientapp.exe.config, you need to add following configuration settings.
  <defaultProxy enabled="true">
    <proxy proxyaddress="" bypassonlocal="False" />
  1. By using useDefaultWebProxy attribute in the binding element.
    <binding name="BasicHttpBinding_IService1" 
             useDefaultWebProxy="false" />

For me it is also not working :(

  1. By using Hostname instead of localhost. - This is the only solution worked for me. :) Modify you clientapp.exe.config, and change the endpoint address from localhost to the actual host name.
  <endpoint address="http://anurajp/WcfService1/Service1.svc" 
      name="BasicHttpBinding_IService1" />

This is the proxy request and response captured using Fiddler.

WCF Request and Response using Fiddler

Happy Programming :)

Copyright © 2024 Anuraj. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Powered by Jekyll. Hosted with ❤ by GitHub