无法加载源 https://api.nuget.org/v3/index.json 的服务索引

Unable to load the service index for source https://api.nuget.org/v3/index.json

我使用 Visual Studio 2019,我在 .NET C 中编程#

到目前为止,一切对我来说都很顺利!但是当我试图在 RAZOR PAGE 中学习新东西时,我无法进行 CRUD。

看完其中一个答案后,我删除了整个 .NUGET IN C:/users 文件夹

我不记得第一条错误消息是什么,但我目前遇到了一条错误消息:

[Package source] 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. Authentication failed because the remote party has closed the transport stream.

试试这些建议:

1)关闭VS,删除C:\Users\xxx\AppData\Roaming\NuGet下的整个nuget.config文件,然后重启VS重新生成。然后,尝试再次安装 nuget 包。

2)管理员身份打开 powershell,运行 这些:

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

重启VS再次测试