在尝试连接到Nuget时,我得到了下面的错误,然后我无法连接:

无法加载源的服务索引 https://api.nuget.org/v3/index.json。 发送请求时发生错误。 无法连接到远程服务器 连接尝试失败,原因是被连接方在一段时间后没有正确响应,或已建立连接 由于连接的主机未能响应68.232.34.200:443而失败

我可以在浏览器上访问https://api.nuget.org/v3/index.json。


当前回答

简单:

关闭VS2019 去c:\ users \you\ appdata \ roam \ nuget 删除文件NuGet。配置 重启VS2019

你可以开始了!

其他回答

值得注意的是,.net核心SSL身份验证存在一个可能导致这种情况的错误。禁用他们最新的网络堆栈实现,为我解决了这个问题。

你可以永久地设置它,或者使用以下命令启动你的应用程序:

DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0 dotnet ...

我使用VSO/Azure DevOps。

您也可以直接在浏览器中访问提要url。你最终可能会得到这样的回复,这可能会让你的诊断更快:

用户没有使用ms.feed扩展名的许可证。

当我试图在本地托管的Gitlab实例中设置NuGet包时遇到了这个错误。错误提示401未经授权的代码。解决方案是用以下方法去除有害源:

nuget source Remove -Name SOURCE_NAME

然后添加相同的源,但这次在命令中指定用户名和密码:

nuget source Add -Name SOURCE_NAME -Source SOURCE_URL -UserName GITLAB_DEPLOY_TOKEN_USERNAME -Password GITLAB_DEPLOY_TOKEN

I had the same error message while scaffolding Identity to my ASP.NET Core MVC project. Since my connection was not behind a proxy, removing/editing proxy configurations didn't make sense. And I didn't want to delete a file or uninstall PMC either. While looking around I realized a "Clear All Nuget Cache(s)" button on Tools --> Options --> NuGet Package Manager --> General. After pressing the button I had to wait for some time for the operation to complete. After that I tried to scaffold the Identity again but it didn't work. Then I decided to restart VS and voila :)

我通过安装IISCrypto并在命令行上运行来修复这个问题:

IISCryptoCli.exe /template default /reboot