nuget.org:无法加载服务索引

发布于 2025-01-22 12:26:34 字数 1027 浏览 1 评论 0 原文

这并不是真正的重复问题由于提供的答案不起作用,而且我使用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>

This is not really a Duplicate to this question as the answers provided are not working and I am using Windows-7 on a MacBook using Bootcamp.

I am getting the following error while trying to search any package in the Nuget Package Manager:

Severity Code Description Project File Line Suppression State
Error [nuget.org] Unable to load the service index for source https://api.nuget.org/v3/index.json.
An error occurred while sending the request.
The underlying connection was closed: An unexpected error occurred on a send.
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
An existing connection was forcibly closed by the remote host

My NuGet Config File (%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 技术交流群。

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

发布评论

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

评论(3

终难愈 2025-01-29 12:26:34

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

梦境 2025-01-29 12:26:34

好吧..让我尝试一下,如果这可以节省您的一天。我遇到了同样的问题,我尝试了这篇文章中提到的所有内容,并在下面提到的几篇相关帖子(从5 - 6年前开始),但不幸的是,没有任何效用。 >。这可能是一个临时解决方案,但是如果这种故障是由某些Windows Update或Network Policy或Anti Virus引起的,什么不是!

我的情况:
我的少数几个开发PC(Win11,Win10)与2022(17.7.5)开始显示此错误,当时是Visual Studio的解决方案时的错误:

[nuget]无法加载源的服务索引
<发送时发生错误
请求。无法解决远程名称:'api.nuget.org'

有趣的是,在其他PC上也可以使用。我花了很多时间调试并遵循以下线程。进行了许多重新启动,重新启动..没有任何帮助。甚至我尝试下载VS 2019以确认,并且出现了同样的问题。

C:\Windows\System32> ping api.nuget.org
Ping request could not find host api.nuget.org. Please check the name and try again.

因此,我意识到这是一个网络上的东西,它在我的一台PC上弄乱了,因此无法解决Api.nuget.org的DNS。我正在编码20多年,但IP配置和其他网络内容仍然使我感到震惊!

我的解决方案:
我在一个好的PC(命令提示符)上运行了此操作:

C:\Windows\System32>ping api.nuget.org
Pinging part-0010.t-0009.t-msedge.net [13.107.246.38] with 32 bytes of data:
Reply from 13.107.246.38: bytes=32 time=71ms TTL=57
Reply from 13.107.246.38: bytes=32 time=19ms TTL=57
...

并将其添加到BAD PC上的主机文件中(C:\ Windows \ System32 \ drivers \ etc):

13.107.246.38   api.nuget.org

...和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:

[nuget] unable to load the service index for source
https://api.nuget.org/v3/index.json. an error occurred while sending
the request. the remote name could not be resolved: 'api.nuget.org'

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.

C:\Windows\System32> ping api.nuget.org
Ping request could not find host api.nuget.org. Please check the name and try again.

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):

C:\Windows\System32>ping api.nuget.org
Pinging part-0010.t-0009.t-msedge.net [13.107.246.38] with 32 bytes of data:
Reply from 13.107.246.38: bytes=32 time=71ms TTL=57
Reply from 13.107.246.38: bytes=32 time=19ms TTL=57
...

and added this to the hosts file on the bad PC (C:\Windows\System32\drivers\etc):

13.107.246.38   api.nuget.org

...and boom!!!

Related posts (I tried all answers and it didn't work for me):

帥小哥 2025-01-29 12:26:34

对于我重建解决方案或项目的工作。

For me rebuilding the solution or the project worked.

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