使用Fiddler来嗅探Visual Studio 2013请求(代理防火墙)

我有问题与Visual Studio 2013和我们的公司代理(login不起作用,更新不起作用,Visual Studio画廊不工作,Nuget和GIT失败)。 所有这些都在做http或https请求。 (例如http://visualstudiogallery.msdn.microsoft.com/ )。 在VS2013中,我只是旋转进度条或关于没有networking连接的消息。

浏览器(Chrome,IE,Firefox)没有问题,因为他们都了解代理(407拒绝,然后凭证)。

所以我想弄清楚为什么VS2013不起作用。 但是当我告诉fiddler2观看DEVENV.EXE进程(或所有进程)时,我看不到任何stream量。

顺便说一句,我已经尝试了一些更改到web.config(devenv.exe.config)文件,以确保它去代理(我看到这在堆栈生成器),但它不适合我。 请参阅以下部分的补充内容:

<system.net> <defaultProxy useDefaultCredentials="true" enabled="true"> <proxy proxyaddress="http://gw6.OURSITE.com:3128" /> </defaultProxy> <settings> <ipv6 enabled="true"/> <servicePointManager expect100Continue="false" /> </settings> </system.net> 

更新

埃里克,我把你的build议,只是塞进到C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe.config文件。

我投入的是:

  <system.net> <defaultProxy useDefaultCredentials="true" enabled="true"> <proxy autoDetect="false" bypassonlocal="false" proxyaddress="http://127.0.0.1:8888" usesystemdefault="false" /> </defaultProxy> </system.net> 

我发现VS2013没有发送用户代理string。 它确实知道#407,并用凭证回复,但网关仍然需要一个用户代理:

 HTTP/1.1 200 OK Cache-Control: no-cache Pragma: no-cache Content-Type: text/html; charset=utf-8 Proxy-Connection: close Connection: close Content-Length: 1341 <html> <head> <title>Access Policy Denied: No User-Agent Specified</title> <meta name="description" content="Web Access Policy"> </head> <body> 

如果您想使用Fiddler查看stream量,则可能需要更改machine.config文件的path,以便所有.NET应用程序都能通过Fiddler发送stream量。 这有助于确保您从服务中运行的进程中捕获数据等。

在文件夹C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config打开machine.config 。 请注意,如果您正在debugging64位服务(如ASP.NET),则需要查看Framework64文件夹而不是Framework文件夹。 同样,如果您使用4.0以前的.NET版本,则需要调整path的版本部分。

将以下XML块作为对等添加到现有system.net元素中,如果存在,则replace任何现有的defaultProxy元素:

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

Ref http://fiddler2.com/blog/blog/2013/01/08/capturing-traffic-from-.net-services-with-fiddler

注意:如果您愿意,您可以使用Fiddler在出站请求上注入User-Agent头。 此外,在最新版本的Fiddler中,您可以使用文件>导入>数据包捕获来收集使用Microsoft NetMon或Microsoft消息分析器捕获的.cap文件中的HTTPstream量。

我的老板build议解决这个问题的另一个简单的方法。 你可以在uri里添加“fiddler”。 例如: http:// localhost:52101 / – > http://localhost.fiddler:52101 /

或者,你可以使用轻量级的方式;

if(Debugger.IsAttached){request.Proxy = new WebProxy(“ http://localhost:8888/ ”,true); }