C# NuGet VS 2012 ServicePointManager 不支持使用 https 方案的代理

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12094287/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 22:03:16  来源:igfitidea点击:

NuGet VS 2012 ServicePointManager does not support proxies with the https scheme

c#nugetvisual-studio-2012

提问by Superman

I have recently upgraded from VS2012 RC to RTM, and since the upgrade to RTM, I can no longer access nuget. I receive the following error in the Manage NuGet Packages window.

我最近从VS2012 RC升级到RTM,自从升级到RTM后,我无法再访问nuget。我在“管理 NuGet 包”窗口中收到以下错误。

The ServicePointManager does not support proxies with the https scheme.

I looked at the solution offered herein a previous stack overflow question, but it does not apply to me as I am not behind a firewall (certainly not supposed to be and verified by http://whatismyipaddress.com/proxy-check). I can also see the RSS feeds / VS can access other network resources, which in the previous question the problem was related to all VS internet traffic not just NuGet as it is in my case.

我看着给出的解决方案在这里在以前的堆栈溢出的问题,但因为我不是一个防火墙(当然不应该是人核实,其背后并不适用于我http://whatismyipaddress.com/proxy-check)。我还可以看到 RSS 提要/VS 可以访问其他网络资源,在上一个问题中,问题与所有 VS 互联网流量有关,而不仅仅是 NuGet,就像我的情况一样。

Any ideas what could have caused this, or how to restore access to NuGet? I have tried this on my machines at work, and my personal computer at home, all with the same effect.

任何可能导致这种情况的想法,或者如何恢复对 NuGet 的访问?我在工作的机器上和家里的个人电脑上都试过这个,都是一样的效果。

采纳答案by Dave Swersky

The solution is in this answer:

解决方案在这个答案中:

Visual Studio 2010 nuget error: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel

Visual Studio 2010 nuget 错误:底层连接已关闭:无法为 SSL/TLS 安全通道建立信任关系

The problem is related to a bad SSL cert on the default Nuget package source.

该问题与默认 Nuget 包源上的错误 SSL 证书有关。

回答by Wilkoteq

This also happens if you have a proxy setup in your internet settings.

如果您在 Internet 设置中设置了代理,也会发生这种情况。

回答by wisbucky

Check your system environment variables for http_proxyand https_proxy. NuGet looks at those first if they exist. If those proxy environment variables begin with https, NuGet will fail. Fix them and restart your computer (restarting Visual Studio did not work for me).

检查您的系统环境变量http_proxyhttps_proxy。如果它们存在,NuGet 首先查看它们。如果这些代理环境变量以 开头https,NuGet 将失败。修复它们并重新启动您的计算机(重新启动 Visual Studio 对我不起作用)。

You can verify this by opening the Package Manager Console:

您可以通过打开包管理器控制台来验证这一点:

Get-Childitem env:http_proxy
Get-Childitem env:https_proxy

If you want to quickly get it working without restarting your computer, manually set the proxies in the Package Manager Console:

如果您想在不重新启动计算机的情况下快速使其工作,请在包管理器控制台中手动设置代理:

$env:http_proxy = "http://your.proxy.com:1234"
$env:https_proxy = "http://your.proxy.com:1234"

回答by Kit

A very late answer, but I've been getting the exact same message when restoring Nuget packages in VS 2015. It seems that last time I restarted my machine I didn't stop Fiddler, and Fiddler seems to have left something in a funny state. When I started and exited from Fiddler the issue went away.

一个很晚的答案,但在 VS 2015 中恢复 Nuget 包时我得到了完全相同的消息。似乎上次我重新启动我的机器时我没有停止 Fiddler,而 Fiddler 似乎在一个有趣的状态下留下了一些东西. 当我从 Fiddler 开始和退出时,问题就消失了。

回答by Thomas

I started getting this in VS2015 on one of my machines. I had an additional package feed on myget which constantly asked me for credentials and failed even when entering correct credentials. What helped me was clearing the nuget cache and config by deleting these two nuget folders:

我开始在我的一台机器上的 VS2015 中得到这个。我在 myget 上有一个额外的包提要,它不断要求我提供凭据,即使输入正确的凭据也失败。通过删除这两个 nuget 文件夹来帮助我清除 nuget 缓存和配置:

  • %APPDATA%\NuGet
  • %LOCALAPPDATA%\NuGet
  • %APPDATA%\NuGet
  • %LOCALAPPDATA%\NuGet

After that I restarted Visual Studio and added my custom package source again.

之后,我重新启动了 Visual Studio 并再次添加了我的自定义包源。

回答by Teoman shipahi

I am not sure what happened in my nuget usage history but I end up stuck using proxy for my development machine. to make it work.

我不确定我的 nuget 使用历史记录中发生了什么,但我最终在我的开发机器上使用代理。使其工作。

1- open fiddler

1-打开提琴手

2- goto %AppData%\NuGet\NuGet.config

2-转到 %AppData%\NuGet\NuGet.config

Package sources

包源

<packageSources>
    <add key="nuget http" value="http://www.nuget.org/api/v2/" />
    <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
</packageSources>

3- config

3-配置

<config>
    <add key="HTTP_PROXY" value="http://127.0.0.1:8888" />
  </config>

4- profit.

4-利润。

回答by Dinesh Phalwadiya

I also faced the same issue for that I just closed my fiddler and restarted Visual Studio to solve the problem

我也遇到了同样的问题,因为我刚刚关闭了我的提琴手并重新启动了 Visual Studio 来解决这个问题

回答by Coder22

NuGet VS 2015 ServicePointManager does not support proxies with the https scheme

NuGet VS 2015 ServicePointManager 不支持使用 https 方案的代理

Problem was not with proxy because the proxy was removed in my case. Therefore the visual studio config file had to be changed. But in other cases the answer can also lie in changing the config file to your situation.

问题不在于代理,因为在我的情况下代理已被删除。因此必须更改 Visual Studio 配置文件。但在其他情况下,答案也可能在于根据您的情况更改配置文件。

Go to: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE

去: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE

find the config file devenv.exe.configand edit in administrator mode:

找到配置文件devenv.exe.config并在管理员模式下编辑:

        <defaultProxy enabled="false" useDefaultCredentials="true">  
            <proxy bypassonlocal="True" proxyaddress="http://proxy.somesite.nl" />  
        </defaultProxy> 

setting enabled="false" or adapt the section to your needs.

设置 enabled="false" 或根据您的需要调整该部分。

Restart VS after changes.

更改后重新启动VS。

回答by Johan Franzén

I got this just by having Fiddler installed. I tried starting it and quitting to be sure it wasn't running but still couldn't get Nuget to work. There must be some other hooks left.

我只是通过安装 Fiddler 得到了这个。我尝试启动它并退出以确保它没有运行,但仍然无法让 Nuget 工作。一定还有一些其他的钩子。