Using Fiddler to sniff Visual Studio 2013 requests (proxy firewall)

Dr.YSG picture Dr.YSG · Jan 10, 2014 · Viewed 39.7k times · Source

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.

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

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

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>

Update

Eric, I took your suggestion and just stuffed it into the C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe.config file.

What I put in was:

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

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>

Answer

EricLaw picture EricLaw · Jan 17, 2014

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.

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.

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>

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

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.