在尝试连接到Nuget时,我得到了下面的错误,然后我无法连接:
无法加载源的服务索引 https://api.nuget.org/v3/index.json。 发送请求时发生错误。 无法连接到远程服务器 连接尝试失败,原因是被连接方在一段时间后没有正确响应,或已建立连接 由于连接的主机未能响应68.232.34.200:443而失败
我可以在浏览器上访问https://api.nuget.org/v3/index.json。
在尝试连接到Nuget时,我得到了下面的错误,然后我无法连接:
无法加载源的服务索引 https://api.nuget.org/v3/index.json。 发送请求时发生错误。 无法连接到远程服务器 连接尝试失败,原因是被连接方在一段时间后没有正确响应,或已建立连接 由于连接的主机未能响应68.232.34.200:443而失败
我可以在浏览器上访问https://api.nuget.org/v3/index.json。
当前回答
我花了一天的时间,试遍了这里的一切。 对我来说,我没有在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.
其他回答
去
设置(PC全局设置)>网络和Internet >代理>自动代理设置>和“自动检测设置”设置为“关闭”。
禁用防病毒应用程序。 以我为例,AVG阻止我访问nuget.org
在我的例子中,问题在于我是在旧的Win7虚拟机上构建的。
我从https://github.com/NuGet/NuGetGallery/issues/8176#issuecomment-683923724找到了这个修复:
nuget.org started enforcing the use of TLS 1.2 (and dropped support for TLS 1.1 and 1.0) earlier this year. Windows 7 has TLS 1.2 disabled by default (check the DisabledByDefault value under HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client in your registry). To enable the support, please make sure you have an update (*) installed and switch the support on: 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
(*)更新指的是Microsoft kb3140245: Windows 7更新(KB3140245)
我安装了更新,重新启动(按照更新的要求),添加了那些注册表项,然后Nuget就可以正常工作了。
我使用VSO/Azure DevOps。
您也可以直接在浏览器中访问提要url。你最终可能会得到这样的回复,这可能会让你的诊断更快:
用户没有使用ms.feed扩展名的许可证。
好吧,我尝试了上面所有的答案,希望我的注册表现在不是软管。但这似乎解决了我的问题:
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个小时寻找解决方案的人!!