nuget.org:无法加载服务索引
这并不是真正的重复问题由于提供的答案不起作用,而且我使用bootcamp 在MacBook上使用Windows-7。
在尝试搜索Nuget软件包管理器中的任何软件包时,我会遇到以下错误:
严重性代码描述项目文件行抑制状态 错误[nuget.org]无法为源 https://api.nuget.orgget.orget.orgget.orget.orget.orget.orget.orget.orget.orget.orget.orget.orget.orget.orget.orget.orget.orget.orget.orget.orget.org, /v3/index.json 。 发送请求时发生错误。 基础连接已关闭:发送时发生了意外的错误。 无法从传输连接中读取数据:现有连接被远程主机强行关闭。 现有的连接被远程主机强行关闭
我的nuget config文件(%appdata%/nuget
):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Nuget.org开始强制使用TLS 1.2(并放弃了对TLS 1.1和1.0的支持)。 的禁用Bydefault值
在您的注册表中查看“ hklm \ System \ contractrolset \ control \ SecurityProviders \ SecurityProviders” \ SecurityProviders \ SecurityProviders \ securityProviders \ tls 1.2 \ client在您的注册表中
。要启用支持,请确保已安装更新并切换支持:
reg添加“ HKLM \ System \ CurrentControlset \ Control \ control \ SecurityProviders \ Schannel \ Schannel \ Schannel \ stoloptions \ tls 1.2 \ tls 1.2 \ client” / /d 0 /f /reg:32 < /code>
reg添加“ HKLM \ System \ CurrentControlset \ Control \ Control \ SecurityProviders \ SecurityProviders \ Schannel \ Schannel \ stologe reg:64 < /code>
reg添加“ HKLM \ System \ CurrentControlset \ Control \ SecurityProviders \ SecurityProviders \ Schannel \ Schannel \ stologe >
reg添加“ HKLM \ System \ CurrentControlset \ Control \ SecurityProviders \ SecurityProviders \ Schannel \ stologity \ stologe \ tls 1.2 \ client” /v enabled /v enabled /t reg_dword /d reg_dword /d 1 /f /reg:64 < /code>
Nuget.org started enforcing the use of TLS 1.2 (and dropped support for TLS 1.1 and 1.0). Check the DisabledByDefault value under,
HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client in your registry.
To enable the support, please make sure you have an update installed and switch the support on:
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v DisabledByDefault /t REG_DWORD /d 0 /f /reg:32
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v DisabledByDefault /t REG_DWORD /d 0 /f /reg:64
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v Enabled /t REG_DWORD /d 1 /f /reg:32
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v Enabled /t REG_DWORD /d 1 /f /reg:64
好吧..让我尝试一下,如果这可以节省您的一天。我遇到了同样的问题,我尝试了这篇文章中提到的所有内容,并在下面提到的几篇相关帖子(从5 - 6年前开始),但不幸的是,没有任何效用。 >。这可能是一个临时解决方案,但是如果这种故障是由某些Windows Update或Network Policy或Anti Virus引起的,什么不是!
我的情况:
我的少数几个开发PC(Win11,Win10)与2022(17.7.5)开始显示此错误,当时是Visual Studio的解决方案时的错误:
有趣的是,在其他PC上也可以使用。我花了很多时间调试并遵循以下线程。进行了许多重新启动,重新启动..没有任何帮助。甚至我尝试下载VS 2019以确认,并且出现了同样的问题。
因此,我意识到这是一个网络上的东西,它在我的一台PC上弄乱了,因此无法解决Api.nuget.org的DNS。我正在编码20多年,但IP配置和其他网络内容仍然使我感到震惊!
我的解决方案:
我在一个好的PC(命令提示符)上运行了此操作:
并将其添加到BAD PC上的主机文件中(C:\ Windows \ System32 \ drivers \ etc):
...和BOOM!
相关帖子(我尝试了所有答案,对我来说没有工作):
Well.. let me try if this can save your day. I faced the same issue, and I tried everything mentioned in this post and few related posts (started 5-6 years ago) mentioned below, but unfortunately nothing worked.. until I had a trick that solved my problem. This could be a temp solution but could save hours if this glitch is caused by some Windows update or network policy or Anti Virus and what not!
My situation:
One of my few development PCs (Win11, Win10) with VS 2022 (17.7.5) started showing this error when building the solution from Visual Studio:
Interestingly the same was working on other PCs. I spent many hours debugging and following the below threads. Did many reboots, restarts.. nothing helped. Even I tried downloading VS 2019 to confirm and the same issue showed up.
So I realized this is a network thing that messed up on one of my PCs and it was not able to resolve the DNS for api.nuget.org. I'm coding for more than 2 decades but still the IP config and other networking stuff freaks me out!
My Solution:
I ran this on a good PC (command prompt):
and added this to the hosts file on the bad PC (C:\Windows\System32\drivers\etc):
...and boom!!!
Related posts (I tried all answers and it didn't work for me):
对于我重建解决方案或项目的工作。
For me rebuilding the solution or the project worked.