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

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

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


当前回答

我必须在命令提示符中从.sln所在的文件夹中运行dotnet还原,这是成功的(而VS还原nuget包失败)。在此之后,我至少可以在Visual Studio下列出已安装的包,但“更新”仍然无法加载。

其他回答

如果您是Windows用户,您可以在凭证管理器中删除或更新您的凭证。

Windows 10下,进入如下路径:

控制面板→所有控制面板项→证书管理器

或者在开始菜单的“搜索Windows”部分搜索“凭据管理器”。

然后在凭证管理器中,选择“Windows凭证”。

证书管理器将显示许多项,包括您的outlook和GitHub存储库下的“通用证书”

单击Git右侧的下拉箭头:它将显示编辑和删除选项。如果您删除,证书将在下次获取或拖动时弹出。或者你可以直接在那里编辑凭证。

就我而言,我在不知情的情况下注销了我的工作账户。重新登录我的visual studio帐户解决了这个问题。

为了支持@Eddie Chen提供的答案(这里),我不得不将http_proxy设置添加到以下文件中:

C: \ Windows \ system32 \漫游配置systemprofile \ AppData \ \鸡块鸡块。配置

<add key="http_proxy" value="http://your_proxy_url:8080" />

如果你使用的是公司代理,并且在Mac上,只需确保你的http/https复选框被选中并应用。

我花了一天的时间,试遍了这里的一切。 对我来说,我没有在Visual Studio中更新我的密码!

I had changed my work Microsoft account password last week or so, I also use that account to login to visual studio, however I wasn't prompted to update it and was not logged out of Visual Studio, it remained logged in. When I clicked on my initials in the top right of visual studio > Account settings > under All Accounts the work account had yellow exclamation triangle warning sign next to it, updated the new password, then updated some packages, dotnet restore, cleaned & rebuilt and the errors are gone.