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

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

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


当前回答

我尝试了这里列出的许多答案,但这些都不能解决问题。最后,我不得不在Windows中的凭据管理器中删除“Windows凭据”下的VSCredentials_xxx条目,并重新启动Visual Studio 2019。

在那之后——在下一次VS启动时——VS终于向我要了代理凭证——在输入它们之后,Visual Studio就可以访问互联网了。

(似乎VS很久以前就存储了我最初提供的代理凭据-但因为在我们公司,他们在强制执行3个月后更改密码-凭据不再有效。)

其他回答

我试图添加一个Azure Artifacts NuGet源。

在这里,我遵循了微软的指示,但有一个关键的疏忽。

我忘记替换/v3/index了。Json和/v2。

似乎Nuget仍然使用代理脚本地址(对于我们的VPN),即使代理设置被禁用。我删除了脚本地址,它工作。

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

如果您看到如下错误,您可能需要设置Azure Artifacts凭据,请参阅Github链接,您可以通过运行powershell脚本或手动安装凭据提供程序。

error :   Response status code does not indicate success: 401 (Unauthorized).

我有这个错误,然后我意识到我是用我的个人微软帐户而不是我的工作帐户登录的。

希望这能有所帮助。