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

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

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


当前回答

好吧,我尝试了上面所有的答案,希望我的注册表现在不是软管。但这似乎解决了我的问题:

https://learn.microsoft.com/en-us/answers/questions/959588/visual-studio-2022-won39t-connect-to-nuget.html

添加这个:TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384

到this中逗号分隔的字符串:

微软HKLM \ SOFTWARE \政策\ \ SSL加密\ Configuration \ \ 00010002

我希望这能帮助下一个希望在周六早上快速进行有趣的概念验证,然后花3个小时寻找解决方案的人!!

其他回答

该错误可能是由临时网络问题引起的,如果重试,该错误将消失。

如果您得到此错误,但没有代理服务器,则可以转到

%userprofile%\AppData\Roaming\NuGet\NuGet.Config

并注释这行:

<config>
     <!-- Proxy settings -->
     <add key="http_proxy" value="host" />
     <add key="http_proxy.user" value="username" />
     <add key="http_proxy.password" value="encrypted_password" />
</config>

它为我工作,因为我得到了这个错误,但我没有代理服务器。

我花了一天的时间,试遍了这里的一切。 对我来说,我没有在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.

我使用VSO/Azure DevOps。

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

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

也许这有帮助

对我来说,删除位于C:\Users\YourNameHere的.nuget文件夹解决了这个问题。