Visual Studio Express 2013 behind proxy

2019-03-02 13:40发布

I've just downloaded and installed visual studio express 2013 for windows desktop.

I'm working behind a proxy with username/password authentication and I don't find how to register the product (witch is now active for 14 days).

Each time : 407 - Proxy Authentication Required

I tried editing the WDExpress.exe.config to add in the section

    <defaultProxy>
        <proxy
        usesystemdefault="true"
        proxyaddress="http://x.x.x.x:8080"
        bypassonlocal="true"
        />

but it's nor working.

2条回答
不美不萌又怎样
2楼-- · 2019-03-02 14:21

This solution works for Visual Studio 2017 but can be adapted to similar errors and applications. Can be used as a general method to Visual Studio proxy errors, just changing processes and locations. UPDATE: It works for Visual Studio 2015 too. You must configure one process only.

Follow the next steps:

  1. Create a dll with authentication data.
  2. Copy the dll to directory of each process
  3. Configure Visual Studio ".exe.config" XML file for each process to use the dll created. 4.(optional) Try Visual Studio when monitoring with Fiddler.

  1. You can use a lightweight IDE like SharpDevelop to create the dll. In ShareDevelop, click in File->New->Solution and select the category C#/Windows Application/windows User Control Library. Name the application as AuthProxy. Create one class named AuthProxyModule.cs and put this code inside:

    using System;
    using System.Net;
    
    namespace AuthProxy
    
    {
        public class AuthProxyModule : IWebProxy
        {
    
            ICredentials crendential = new NetworkCredential("USERNAME", "PASSWORD");
    
                public ICredentials Credentials    
                {    
                    get
                    {
                        return crendential;
                    }
                    set
                {
                    crendential = value;
                }
            }
    
            public Uri GetProxy(Uri destination)
            {
                return new Uri("http://proxy:8080", UriKind.Absolute);
            }
    
            public bool IsBypassed(Uri host)
            {
                return host.IsLoopback;
            }
        }
    }
    

    In "USERNAME" and "PASSWORD" you should set with the correct values for you. Also you should configure the right URI (in the example, proxy:8080) Build the solution and you can get the AuthProxy.dll in the solution/bin/Debug folder. This step is based on this site.

  2. Copy the Authproxy.dll file to this directories:

    • (2017, 2015) C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE
    • (2017 only) C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\ServiceHub\Services\Microsoft.Developer.IdentityService
    • (2017 only) C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\ServiceHub\Services\Microsoft.Developer.Settings
    • (2017 only) C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\ServiceHub\Hosts\ServiceHub.Host.CLR.x86
  3. Then Add the code below between and tags:

    <system.net>
      <defaultProxy>
        <module type="AuthProxy.AuthProxyModule, AuthProxy"/>
      </defaultProxy>
    </system.net> 
    

    to this XML config files in the directories from the step 2 respectively:

    • devenv.exe.config (2015, 2017)
    • Microsoft.Developer.IdentityService.dll.config (2017)
    • Microsoft.Developer.Settings.dll.config (2017)
    • ServiceHub.Host.CLR.x86.exe.config (2017)
  4. Monitoring with Fiddler. In Fiddler, the column Process shows devenv or servicehub.identityhub or servicehub.settingshost. The process which generates the request.

    The column Result shows 407 when an error occurred. The 200 is shown when it is working. The connections HTTP/1.1 will return 407. The connections HTTP/1.0 should return 200. If not, you must check the config file associated to the process.

    In the Inspectors tab, click on Auth view for the request and Headers view for the response. It is a simple way to understand what it is happens.

Notes: Keep in mind that if you upgrade Visual Studio, devenv.exe.config file is modified and <system.net> is automatically changed by the installer to:

    <system.net>
      <settings> 
        <ipv6 enabled="true"/>
      </settings>
    </system.net>

You should reconfigure the processes.

This solution seems complicated but it works for me and allow me understanding and monitoring what is it happens.

查看更多
时光不老,我们不散
3楼-- · 2019-03-02 14:36

Go to your visual studio folder, search for the devenv.exe.config file, search for <system.net> tag and replace it with the following:

<system.net>
  <defaultProxy useDefaultCredentials="true" />
</system.net>
查看更多
登录 后发表回答