Package manager in Visual Studio 2015 “407 (Proxy Authentication Required)”

不羁的心 提交于 2019-11-28 11:12:10

I had the same problem a few weeks ago. For me it has helped to put in the the following in the machine.config (Windows/Microsoft.NET/Framework64/v4.0.30319/Config)

<system.net>
   <settings>
       <ipv6 enabled="True"/>
   </settings>
   <defaultProxy useDefaultCredentials="True" enabled="True">
       <proxy proxyaddress="http://your.proxyserver.ip:port"/>
   </defaultProxy>
</system.net>

I had to modify the 32 bit machine.config (assumption being VS runs in 32 bit) to add the <system.net> section but omitting anything within the <defaultProxy> tag:

<system.net>
    <defaultProxy useDefaultCredentials="True" enabled="True" />
</system.net>

According to MSDN:

If the defaultProxy element is empty, the proxy settings from Internet Explorer will be used.

This is perfect for me as every other application on my machine works - including IE.

manchine.config location (Win 7): %SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319\Config\machine.config


Note

I resolved this thanks to @user3063127 pointing me in the right direction (you have an upvote). As far as I can tell this only affects package restore on DNX projects and may well be fixed when RC2 is released.

Glyn
  1. Updated to latest nuget.exe 1st

    nuget update self
    
  2. Added proxy details to the config file:

    nuget config -Set http_proxy=http://username:password@proxyserver.company.com:port
    
Chethan Shetty

If you have Fiddler installed, tick the option 'Automatically Authenticate' under the Rules option, should fix the above issue.

Selecting the Automatically Authenticate

Got this from the following post Configuring Fiddler to use company network's proxy?

You need to modify file 2 .config files:

for Visual Studio 2015

  • C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\vsn.exe.config
  • C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe.config

for Visual Studio 2017

  • C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\vsn.exe.config
  • C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe.config
<system.net>
  <defaultProxy enabled="true" useDefaultCredentials="true">
    <proxy usesystemdefault="True" bypassonlocal="True" proxyaddress="http://yourproxy:proxyport" />
    <bypasslist>
      <add address="(.*\.)?anyotherdomain\.com?(.*)" />
      <add address="(.*\.)?nuget\.org?(.*)" />
      <add address="192\.168\.\d{1,3}\.\d{1,3}" />
    </bypasslist>
  </defaultProxy>
  <settings>
    <ipv6 enabled="false"/>
    <servicePointManager expect100Continue="false"/>
  </settings>
</system.net>

The bypass for nuget.org will work if, without the proxy, you still can get it's IP from DNS server and nothing else is blocking it.

Also need this to install nuget

Open the file C:\Users\[YOUR_USER_NAME]\AppData\Roaming\NuGet\NuGet.Config and add inside the <configuration> <\configuration> tag the following:

<config>
  <add key="http_proxy" value="http://yourproxy:proxyport" />
</config>

Taken from Marco Mengoli's Blog

If you don't know the proxy server details, you can go with other workaround to overcome this error "407 (Proxy Authorisation Required.)"

Workaround: 1. Download/Install Fiddler 2. Click Menu Rules -> Automatically Authenticate

Without closing Fiddler, now try to do restore package in Visual Studio. It should now restore the packages without any proxy error.

This is not a neat solution, but still an alternate workaround to resolve this issue. This solution tries to utilise Fiddler as Proxy.

Maybe you have wrong proxy credentials in Credential Manager. Try to remove it.

Control Panel -> User Account -> Credential Manager.

Remove proxy credentials resolved my problem.

Adding proxy username, password fixed my 407 authentication issue.

Place the following snippet in NuGet.config file located at C:\Users\myUserName\AppData\Roaming

<configuration>

   <config>
     <add key="http_proxy" value="http://my.proxy.address:port" />
     <add key="http_proxy.user" value="mydomain\myUserName" />
     <add key="http_proxy.password" value="[base64 encoded Password]" />
   </config>

</configuration>

Ref: https://forums.asp.net/t/2096179.aspx?Proxy+407+Access+Denied

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!