Visual Studio 2010 nuget 错误:底层连接已关闭:无法建立 SSL/TLS 安全通道的信任关系
每当我尝试安装某些东西,甚至只是列出软件包时,我都会收到此错误“底层连接已关闭:无法为 SSL/TLS 安全通道建立信任关系”
我使用最新版本的 Nuget。
我还在 devenv.exe.config 中尝试了不同的选项,如下所示:
<servicePointManager checkCertificateName="false" checkCertificateRevocationList="false"/>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(12)
转至 VS2010 → 工具 → 库包管理器 → 包管理器设置。
选择包管理器 → 包源。
添加新的包源为:
名称:
NugetSource
来源:http://packages.nuget.org/v1/FeedService.svc/
上移新添加的包源到第一个位置。
取消选中现有的“Nuget 官方包源”
重新启动 VS2010。
Go to VS2010 → Tools → Library Package Manager → Package Manager Settings.
Choose Package Manager → Package Sources.
Add a new package source as:
Name:
NugetSource
Source: http://packages.nuget.org/v1/FeedService.svc/
Move Up the newly added package source to first position.
UnCheck existing "Nuget official package source"
Restart VS2010.
转到 https://nuget.org/ 并获取其证书。
例如,如果您使用的是 Firefox:打开 nuget 站点后 - 单击地址栏左侧的站点图标,单击“更多信息”,然后在“安全”选项卡上应该有“网站身份”部分和“查看”证书”按钮。单击此处,在打开的对话框中选择“详细信息”选项卡 - 您应该在其中看到 *.nuget.org 的链。单击底部的“导出”按钮并将证书保存到文件中(手动添加
.cer
扩展名,因为对话框不会为您执行此操作)。现在您需要设置系统以使其信任该证书。按Win+R(将打开“运行”对话框)->在那里输入 mmc 并运行它(如果您打开了 UAC,则具有管理员权限)。那里选择文件->添加或删除管理单元... ->选择左侧的证书,在对话框中选择
计算机帐户
和本地计算机
。单击“确定” - 树的控制台根
中将包含Certificates
节点。打开它和文件夹Trusted People
。从其上下文菜单中选择所有任务 ->导入...->选择您之前导出的文件并将其导入。一切都应该工作正常。
Go to https://nuget.org/ and get its certificate.
For example, if you're using Firefox: after opening nuget site - click site's icon on the left side of address bar, click 'More Information', and on the Security tab there should be 'Web-site identity' section with 'View certificate' button. Click there, in the opened dialog select Details tab - there you should see chain for *.nuget.org. Click button 'Export' at the bottom and save certificate to the file (add
.cer
extension manually, because dialog won't do it for you).Now you need to setup you system so that it will trust the certificate. Press Win+R (Run dialog will be opened) -> type
mmc
there and run it (with admin privileges if you have UAC turned on). There select File -> Add or remove snapin... -> select Certificates on the left, in the dialog selectComputer account
andLocal computer
. Click OK - the tree will haveCertificates
node in theConsole root
. Open it and file folderTrusted People
. From its context menu select All tasks -> Import... -> Select file that you have exported before and import it.Everything should be working fine.
我们在工作中遇到了同样的问题,我们通过删除安全套接字解决了这个问题,Https -> http。这意味着您可以使用 V2 URL http://nuget.org/api/v2/。
可能是摆脱安全套接字的问题,但是上面的 URL (http://packages.nuget.org/v1/ FeedService.svc/) 也是不安全的。
We had the same issue in work, and we resolved this by dropping the secure socket, Https -> http. This means you can use the V2 URL http://nuget.org/api/v2/.
Possibly an issue getting rid of the secure socket, but the above URL (http://packages.nuget.org/v1/FeedService.svc/) is also unsecure.
go.microsoft.com 上的 SSL 证书显然存在问题。将包源 URL 更改为 http://packages.nuget.org/v1/FeedService.svc/ 它应该工作得很好。
There's apparently an issue with the SSL cert on go.microsoft.com. Change the package source url to http://packages.nuget.org/v1/FeedService.svc/ and it should work just fine.
相关:ServicePointManager 不支持采用 https 方案的代理
如果您之前打开过 Fiddler,则您的 nuget.org 证书很可能无效。
如果是这样,请打开 MMC,添加证书管理单元(当前用户)并从个人存储中删除 nuget.org。
由于 Nuget 保留了该证书的句柄(似乎),您将必须重新启动 Visual Studio。之后,你应该玩得很开心。
Related: ServicePointManager does not support proxies with the https scheme
If you've previously had Fiddler open, you might well have a certificate for nuget.org that is invalid.
If so, open up MMC, add the Certificates snapin (current User) and remove nuget.org from the Personal store.
Due to Nuget keeping a handle to this cert (seemingly) you will have to restart Visual Studio. Afterwards, you should have a good time.
进入VS2012->工具->库包管理器 ->包管理器设置
选择包管理器 ->包来源。
这正在我的机器上运行。
Go to VS2012 -> Tools -> Library Package Manager -> Package Manager Settings
Choose Package Manager -> Package Sources.
This is working on my machine.
如果上面的方法不起作用,请尝试此...
尝试将以下内容粘贴到 .reg 文件中并运行它。然后尝试运行 NuGet 命令(无需重新启动)。
遇到此问题是因为未启用 TLS1.2(类似于 Tony 的回复)。使用 http 并不能解决这种情况,因为现在强制执行 TLS1.2,NuGet 会重定向到 https。
感谢“新抄写者”
If nothing from above works, try this....
Try pasting the following into a .reg file and run it. Then try running your NuGet command (no reboot required).
Ran into this issue because TLS1.2 was not enabled (similar to Tony's response). Using http does not fix the situation because NuGet redirects to https now that TLS1.2 is enforced.
thanks to "neoscribe"
截至 2015 年 1 月 21 日,正确的网址为 https://www.nuget.org/api /v2/。 www 是必需的,否则证书将失败。不要退回到 http,因为您正在向令人讨厌的 MITM 向量开放代码及其所有使用者。
As of today 21-Jan-2015, the correct url is https://www.nuget.org/api/v2/. The www is required or the certificate fails. Do NOT fall back to http because you are opening your code and all of its consumers to a nasty MITM vector.
对我来说,问题是通过清除nuget缓存(并重新启动VS)解决的
For me the problem was solved by clearing the nuget cache (and restarting VS)
我可以通过删除安全套接字
https
->
http
来解决这个问题。转到工具
->
Nuget 包管理器->
包源,然后添加新源,但不带https
:这意味着 http://nuget.org/api/v2/。
I could solve this problem by dropping the secure socket,
https
->
http
.Go to Tools
->
Nuget Package Manager->
Package Sources, then add a new source, but withouthttps
:This means http://nuget.org/api/v2/.
我必须在 Nuget 的本地计算机设置中删除 https,并将其添加到“工具”->“用户级别”中。库包管理器 ->包管理器设置 选择包管理器 ->包来源。
I had to remove https in Local machine settings for Nuget and added (http) it to user level in Tools -> Library Package Manager -> Package Manager Settings Choose Package Manager -> Package Sources.
我对任何与 Visual Studio 相关的方法都没有运气。不更新所有内容,不手动添加 https://api.nuget.org/v3 的根证书/index.json 到 windows 等。我如何修复它:
nuget Restore MySolution.sln
下载 nuget 这里。
i have had no luck with any method related to Visual Studio. Not updating everything, not manually adding the Root Certificate of https://api.nuget.org/v3/index.json to windows, etc. How I fixed it:
nuget restore MySolution.sln
Download nuget here.