如何使用Fiddler调试通信从任何应用程序(例如C#/ WPF应用程序) [英] How to use Fiddler to debug traffic from Any app (eg. C#/WPF app)
问题描述
我特林调试什么是错与的这里SO 的另一个问题。所以,我读了一些关于提琴手,想用它来调试我的问题。但我似乎无法从我的WPF应用程序要经过提琴手获得流量。我相信我需要配置一个代理。我使用了一个基本的例子一个WebClient的,但我想以后我将需要的WebRequest。但现在,用一个简单的Web客户端,我怎么能得到它要经过提琴手(我相信我必须设置代理为localhost:8888)?
I am tring to debug whats wrong with my HTTP requests from another question here on SO. So i read a bit about Fiddler and wanted to use it to debug my problem. But I can't 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 I have to set proxy to localhost:8888)?
更新:
我不知道我是否做了正确的事情或没有,但我试过
I don't know if i did the right thing or not but I tried
var wc = new WebClient();
WebProxy proxy = new WebProxy();
proxy.Address = new Uri("http://localhost:8888");
wc.Proxy = proxy;
但失败了 - 我没有看到任何提琴手交通
but failed - I don't see any traffic in Fiddler
我想...
var wc = new WebClient();
WebProxy proxy = new WebProxy("127.0.0.1", 8888);
wc.Proxy = proxy;
仍然一无所获
still nothing
推荐答案
我发现在这个fiddler2.com页面
为什么我看不到流量发送到
的http://本地主机
或 http://127.0.0.1?
Why don't I see traffic sent to
http://localhost
orhttp://127.0.0.1?
Internet Explorer和。 .NET框架是硬编码不通过任何
代理发送
请求本地主机,并作为一个代理,提琴手将
未收到此类流量。
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.
最简单的解决方法是使用你的机器名作为主机名
,而不是本地主机或127.0.0.1。所以,
例如,而不是击中
的http://本地主机:8081 / mytestpage.aspx
,
,而不是访问
的http://机器:8081 / mytestpage.aspx
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
.
这篇关于如何使用Fiddler调试通信从任何应用程序(例如C#/ WPF应用程序)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!