代理后面的Visual Studio Express 2013

时间:2013-10-08 11:25:24

标签: proxy visual-studio-2013

我刚刚下载并安装了适用于Windows桌面的visual studio express 2013.

我在使用用户名/密码身份验证的代理服务器后面工作,我找不到如何注册产品(女巫现在已经活动了14天)。

每次:407 - 需要代理验证

我尝试编辑WDExpress.exe.config以添加

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

但它也不起作用。

2 个答案:

答案 0 :(得分:1)

转到visual studio文件夹,搜索devenv.exe.config文件,搜索<system.net>标记并将其替换为以下内容:

<system.net>
  <defaultProxy useDefaultCredentials="true" />
</system.net>

答案 1 :(得分:0)

此解决方案适用于Visual Studio 2017,但可以适应类似的错误和应用程序。可以用作Visual Studio代理错误的一般方法,只需更改进程和位置即可。 更新:它也适用于Visual Studio 2015。您必须仅配置一个进程。

按照以下步骤操作:

  1. 使用身份验证数据创建dll
  2. 将dll 复制到每个进程的目录
  3. 配置 Visual Studio“.exe.config”每个进程的XML文件以使用创建的dll。 4.(可选)在使用Fiddler进行监控时尝试使用Visual Studio。
    1. 您可以使用像 SharpDevelop 这样的轻量级IDE来创建dll。 在ShareDevelop中,单击文件 - >新建 - >解决方案,然后选择类别 C#/ Windows应用程序/ Windows用户控件库。将应用程序命名为 AuthProxy 。 创建一个名为 AuthProxyModule.cs 的类并将此代码放入其中:

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

      “USERNAME”“PASSWORD”中,您应该为您设置正确的值。您还应该配置正确的URI(在示例中, proxy:8080 ) 构建解决方案,您可以在解决方案/ bin / Debug文件夹中获取AuthProxy.dll。 此步骤基于此site

    2. 将Authproxy.dll文件复制到以下目录:

      • (2017,2015)C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Community \ Common7 \ IDE
      • (仅限2017年)C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Community \ Common7 \ ServiceHub \ Services \ Microsoft.Developer.IdentityService
      • (仅限2017年)C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Community \ Common7 \ ServiceHub \ Services \ Microsoft.Developer.Settings
      • (仅限2017年)C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Community \ Common7 \ ServiceHub \ Hosts \ ServiceHub.Host.CLR.x86
    3. 然后在下面添加代码和标签:

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

      分别来自步骤2

      的目录中的XML配置文件
      • 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. 使用Fiddler监控。 在Fiddler中,进程列显示 devenv servicehub.identityhub servicehub.settingshost 。生成请求的过程。

      发生错误时,结果列显示 407 。工作时会显示 200 。 HTTP / 1.1连接将返回 407 。 HTTP / 1.0连接应返回 200 。如果没有,则必须检查与进程关联的配置文件。

      Inspectors 标签中,单击请求的 Auth 视图和响应的标题视图。这是了解它发生的简单方法。

    5. 注意:请注意,如果升级Visual Studio ,则会修改 devenv.exe.config 文件,安装程序会自动将<system.net>更改为:

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

      您应该重新配置流程。

      这个解决方案似乎很复杂,但它对我有用,让我能够理解和监控它发生了什么。

相关问题