views:

75

answers:

2

I am tring to debug whats wrong with my HTTP requests from another question here on SO. So i read abit about Fiddler and wanted to use it to debug my problem. But I cant seem to get traffic from my WPF application to go through Fiddler. I believe I need to configure a proxy. I am using a WebClient for a basic example, but I think i will require a WebRequest later. But for now, with a simple WebClient, how can I get it to go through Fiddler (I believe set proxy to localhost:8888)?

UPDATE:

I dont know if i did the right thing anot but I tried

var wc = new WebClient();
WebProxy proxy = new WebProxy();
proxy.Address = new Uri("http://localhost:8888");
wc.Proxy = proxy;

but failed - I dont see any traffic in Fiddler

I tried ...

var wc = new WebClient();
WebProxy proxy = new WebProxy("127.0.0.1", 8888);
wc.Proxy = proxy;

still nothing

A: 

Yes, you should configure the client to use localhost:8888 as proxy.

An alternative is to use Wireshark to check the HTTP requests. This way, you do not need to configure a proxy.

Sjoerd
+3  A: 

Err.. I found the solution http://www.fiddler2.com/fiddler/help/hookup.asp#Q-DOTNET

Why don't I see traffic sent to http://localhost or http://127.0.0.1?

Internet Explorer and the .NET Framework are hardcoded not to send

requests for Localhost through any proxies, and as a proxy, Fiddler will not receive such traffic.

The simplest workaround is to use your machine name as the hostname

instead of Localhost or 127.0.0.1. So, for instance, rather than hitting http://localhost:8081/mytestpage.aspx, instead visit http://machinename:8081/mytestpage.aspx.

jiewmeng