使用 Fiddler 嗅探 Visual Studio 2013 请求(代理防火墙) [英] Using Fiddler to sniff Visual Studio 2013 requests (proxy firewall)

查看:44
本文介绍了使用 Fiddler 嗅探 Visual Studio 2013 请求(代理防火墙)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 Visual Studio 2013 和我们的公司代理时遇到问题(登录无效、更新无效、Visual Studio 库无效、nuget 和 git 失败).所有这些都在执行 http 或 https 请求.(例如 http://visualstudiogallery.msdn.microsoft.com/ ).在 VS2013 中,我只会收到有关没有网络连接的旋转进度条或消息.

I am having issues with Visual Studio 2013 and our corporate proxy (signin does not work, updates do not work, visual studio gallery does not work, nuget and git fail ). All of these are doing http or https requests. (e.g. http://visualstudiogallery.msdn.microsoft.com/ ). In VS2013 I just get spinning progress bars or messages about no network connection.

浏览器(chrome、IE、firefox)没问题,因为它们都理解代理(407 拒绝,然后用凭据响应).

No problem with the browser, (chrome, IE, firefox) since they all understand proxies (407 rejections and then responding with credentials).

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

So I want to figure out why VS2013 does not work. But I cannot see any traffic when I tell fiddler2 to watch the DEVENV.EXE process (or all processes).

顺便说一句,我已经尝试对 web.config (devenv.exe.config) 文件进行一些更改以确保它转到代理(我在堆栈构建器中看到了这个),但它对我不起作用.请参阅以下部分的补充内容:

BTW, I have tried some changes to the web.config (devenv.exe.config) file to make sure it goes to the proxy (I saw this in stack builder) but it is not working for me. See the additions to the section below:

    <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>

更新

Eric,我采纳了你的建议,然后将它塞进了 C:Program Files (x86)Microsoft Visual Studio 12.0Common7IDEdevenv.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 没有发送用户代理字符串.它确实知道#407 naks 并用凭据回复,但网关仍然需要用户代理:

What I found was that VS2013 is not sending a user-agent string. It does know about #407 naks and it replies with credentials, but the gateway still wants a user agent:

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 查看流量,你可能想走更改 machine.config 文件的路线,以便所有 .NET 应用程序都将通过 Fiddler 发送流量.这有助于确保您从在服务等中运行的进程捕获数据.

If you want to look at the traffic with Fiddler, you probably want to go the route of changing the machine.config file so that all .NET applications will send traffic through Fiddler. This helps ensure that you capture data from processes running in services, etc.

打开 C:WindowsMicrosoft.NETFrameworkv4.0.30319Config 文件夹中的 machine.config.请注意,如果您正在调试 64 位服务(如 ASP.NET),您将需要查看 Framework64 文件夹而不是 Framework 文件夹.同样,如果您使用的是 4.0 之前的 .NET 版本,则需要调整路径的版本部分.

Open machine.config in the folder C:WindowsMicrosoft.NETFrameworkv4.0.30319Config. Note that if you are debugging a 64bit service (like ASP.NET) you will want to look in the Framework64 folder instead of the Framework folder. Similarly, if you are using a .NET version prior to 4.0, you will need to adjust the version part of the path.

将以下 XML 块添加为现有 system.net 元素的对等体,替换任何现有的 defaultProxy 元素(如果存在):

Add the following XML block as a peer to the existing system.net element, replacing any existing defaultProxy element if present:

<!-- 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>

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

注意:如果您愿意,您可以使用 Fiddler 在出站请求中注入 User-Agent 标头.此外,在最新版本的 Fiddler 中,您可以通过 File > Import > Packet Capture 从使用 Microsoft NetMon 或 Microsoft Message Analyzer 捕获的 .cap 文件中收集 HTTP 流量.

Note: You can use Fiddler to inject a User-Agent header on outbound requests if you like. Also, in the latest version of Fiddler, you can File > Import > Packet Capture to collect HTTP traffic out of .cap files captured using Microsoft NetMon or Microsoft Message Analyzer.

这篇关于使用 Fiddler 嗅探 Visual Studio 2013 请求(代理防火墙)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆