在尝试连接到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。
当前回答
值得注意的是,.net核心SSL身份验证存在一个可能导致这种情况的错误。禁用他们最新的网络堆栈实现,为我解决了这个问题。
你可以永久地设置它,或者使用以下命令启动你的应用程序:
DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0 dotnet ...
其他回答
似乎Nuget仍然使用代理脚本地址(对于我们的VPN),即使代理设置被禁用。我删除了脚本地址,它工作。
该错误可能是由临时网络问题引起的,如果重试,该错误将消失。
我花了一天的时间,试遍了这里的一切。 对我来说,我没有在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.
如果使用Visual Studio 2019,如果你在devenv.exe.config中没有使用任何默认代理,只需删除“defaultproxy”部分。在VS 2017中,这个部分没有出现
改变
<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy bypassonlocal="True" proxyaddress="http://<yourproxy:port#>"/>
</defaultProxy>
to
<!--<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy bypassonlocal="True" proxyaddress="http://<yourproxy:port#>"/>
</defaultProxy>-->
否则,提供适当的代理用户名和密码。
我有一个类似的问题,试图连接到我的私人TFS服务器,而不是公共NuGet API服务器。由于某种原因,我在AD服务器和TFS服务器之间出现了问题,因此它总是返回401。NuGet配置文章展示了你可以像这样将你的AD用户名和密码添加到配置文件中:
<packageSourceCredentials>
<vstsfeed>
<add key="Username" value="yourname@company.com" />
<add key="Password" value="this is an encrypted password" >
<!-- add key="ClearTextPassword" value="not recommended password" -->
</vstsfeed>
</packageSourceCredentials>
这不是一个非常理想的解决方案,更像是一个临时的解决方案,直到我可以找出AD服务器的问题,但这应该可以解决问题。