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

发布于 2024-12-28 14:38:22 字数 491 浏览 3 评论 0 原文

每当我尝试安装某些东西,甚至只是列出软件包时,我都会收到此错误“底层连接已关闭:无法为 SSL/TLS 安全通道建立信任关系”

我尝试了 这个来自 Codeplex 的解决方案没有运气。

我使用最新版本的 Nuget

我还在 devenv.exe.config 中尝试了不同的选项,如下所示:

<servicePointManager  checkCertificateName="false"    checkCertificateRevocationList="false"/>

Whenever I'm trying to install something or even just list the packages I get this error "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel"

I tried this solution from Codeplex with no luck.

I use the latest version of Nuget.

I also tried different options in devenv.exe.config like this:

<servicePointManager  checkCertificateName="false"    checkCertificateRevocationList="false"/>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(12

情场扛把子 2025-01-04 14:38:22
  • 转至 VS2010 → 工具 → 库包管理器 → 包管理器设置。

  • 选择包管理器 → 包源。

  • 添加新的包源为:

  • 上移新添加的包源到第一个位置。

  • 取消选中现有的“Nuget 官方包源”

  • 重新启动 VS2010。

  • Go to VS2010 → Tools → Library Package Manager → Package Manager Settings.

  • Choose Package Manager → Package Sources.

  • Add a new package source as:

  • Move Up the newly added package source to first position.

  • UnCheck existing "Nuget official package source"

  • Restart VS2010.

江南月 2025-01-04 14:38:22

转到 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 select Computer account and Local computer. Click OK - the tree will have Certificates node in the Console root. Open it and file folder Trusted People. From its context menu select All tasks -> Import... -> Select file that you have exported before and import it.

Everything should be working fine.

半山落雨半山空 2025-01-04 14:38:22

我们在工作中遇到了同样的问题,我们通过删除安全套接字解决了这个问题,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.

只等公子 2025-01-04 14:38:22

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.

如梦亦如幻 2025-01-04 14:38:22

相关: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.

Example certificate to remove

Due to Nuget keeping a handle to this cert (seemingly) you will have to restart Visual Studio. Afterwards, you should have a good time.

不寐倦长更 2025-01-04 14:38:22

进入VS2012->工具->库包管理器 ->包管理器设置
选择包管理器 ->包来源。

  1. 添加新的包源为:Name= NugetSource Source= http://packages.nuget.org/ v1/FeedService.svc/
  2. 将新添加的包源上移至第一个位置。
  3. 取消选中现有的“Nuget官方包源”
  4. 重新启动VS2012。

这正在我的机器上运行。

Go to VS2012 -> Tools -> Library Package Manager -> Package Manager Settings
Choose Package Manager -> Package Sources.

  1. Add a new package source as: Name= NugetSource Source= http://packages.nuget.org/v1/FeedService.svc/
  2. Move Up the newly added package source to first position.
  3. UnCheck existing "Nuget official package source"
  4. Restart VS2012.

This is working on my machine.

羁〃客ぐ 2025-01-04 14:38:22

如果上面的方法不起作用,请尝试此...

尝试将以下内容粘贴到 .reg 文件中并运行它。然后尝试运行 NuGet 命令(无需重新启动)。

Windows 注册表编辑器版本 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\v4.0.30319]
"SchUseStrongCrypto"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft.NETFramework\v4.0.30319]
"SchUseStrongCrypto"=dword:00000001

遇到此问题是因为未启用 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).

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\v4.0.30319]
"SchUseStrongCrypto"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft.NETFramework\v4.0.30319]
"SchUseStrongCrypto"=dword:00000001

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"

此岸叶落 2025-01-04 14:38:22

截至 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.

-柠檬树下少年和吉他 2025-01-04 14:38:22

对我来说,问题是通过清除nuget缓存(并重新启动VS)解决的

For me the problem was solved by clearing the nuget cache (and restarting VS)

花辞树 2025-01-04 14:38:22

我可以通过删除安全套接字 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 without https:

This means http://nuget.org/api/v2/.

深海蓝天 2025-01-04 14:38:22

我必须在 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.

演出会有结束 2025-01-04 14:38:22

我对任何与 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文