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

查看:305
本文介绍了使用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.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没有发送用户代理字符串.它确实知道#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应用程序都可以发送通过提琴手的交通.这有助于确保您从服务等中运行的进程捕获数据.

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:\Windows\Microsoft.NET\Framework\v4.0.30319\Config中打开machine.config. 请注意,如果要调试64位服务(如ASP.NET),则需要查找Framework64文件夹而不是Framework文件夹.同样,如果您使用的是4.0之前的.NET版本,则需要调整路径的版本部分.

Open machine.config in the folder C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config. 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中,您可以通过文件">导入">数据包捕获"从使用Microsoft NetMon或Microsoft消息分析器捕获的.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天全站免登陆