Tuesday, September 21, 2010

Fiddler–Capturing HTTP traffic for a WCF client running under an ASP.Net website

If you create a WCF client in an executable application (WinForm, Console, etc), then it is easy to capture the http traffic being exchanged between the client and the server.
But when your WCF client code is inside an Asp.Net website, then Fiddler does not automatically capture the traffic being generated between the client-code and the server.
To enable capturing the http traffic being exchanged by a WCF client implemented inside an ASP.Net website, you need to tell Asp.Net to use Fiddler’s proxy server. This is easily accomplished by adding the following to the web.config file :
The above snippet should be added under the Configuration node (easiest to add it right before the closing Configuration tag).
Once you add the above code, you should be able to capture the http traffic in Fiddler.
Notes: Make sure that Fiddler is capturing for “All Processes” (set in the Fiddler status bar). Also you might have to restart both Fiddler and your Visual Studio (make sure you restart Fiddler before Visual Studio).

1 comment:

Unknown said...

I was trying to capture HTTP traffic sent by a console application.

Took me a couple of hours before I read that Fiddler has a "Browser/All processes" filter in the status bar.

Found it because of this posting, thanks a lot!