配置Fiddler捕获.Net服务

时间:2018-06-19 15:18:40

标签: .net windows-services fiddler

我有一个.Net服务,它创建HttpWebRequest。我想通过Fiddler看到这些。

我已经做了一些搜索,一般的建议是将一个代理添加到machine.config文件中。

<!-- The following section is to force use of Fiddler for all applications, 
Including those running in service accounts -->  <system.net>
<defaultProxy>
<proxy autoDetect="false" bypassonlocal="false" 
proxyaddress="http://127.0.0.1:8888" usesystemdefault="false" />
</defaultProxy>

完成此操作后,我仍然看不到任何东西。

我唯一的区别是我需要在代码中指定另一个代理

const string myProxyHostString = "10.10.10.2";
const int myProxyPort = 8080;
httpWebRequest.Proxy = new WebProxy(myProxyHostString, myProxyPort);

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

您在代码中配置的代理将覆盖使您的请求流经Fiddler的配置。

您真的需要从代码中指定此代理吗?否则,您可以将其放在app.config中,并在调试时将其指向Fiddler,在生产环境中运行时将其指向10.10.10.2

然后在提琴手configure 10.10.10.2 as upstream proxy中进行。

这样,您的请求将像这样流动:

Application -> Fiddler -> 10.10.10.2 -> destination