在尝试连接到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。
当前回答
转到%appdata%\NuGet\NuGet.config 修改这一行: < packageSources > <add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft sdk \NuGetPackages\" /> . <add key="Package source" value="https://api.nuget.org/v3/index.json" /> . < / packageSources >
其他回答
简单:
关闭VS2019 去c:\ users \you\ appdata \ roam \ nuget 删除文件NuGet。配置 重启VS2019
你可以开始了!
当我试图浏览NuGet包时,我得到了同样的错误,以解决以下相同的步骤:
1-转到%appdata%\NuGet\NuGet.config
2-验证该配置中提到的url
3-删除不需要的url
4-重新启动visual studio并检查
我删除了%localappdata%/Nuget中的所有内容,并清除了NuGets缓存。
dotnet nuget locals all --clear
重新启动后,Visual studio 2022恢复了我的包。
如果使用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>-->
否则,提供适当的代理用户名和密码。
我在Windows 10中使用docker-compose up命令在Dockerfile中运行RUN dotnet restore时遇到了同样的错误。
我已经尝试了互联网上提供的所有可能的解决方案,也一直在关注这个公开的问题。最后,在花了8个多小时后,通过遵循前面的步骤,我能够解决我的问题。
Uninstall Docker from your system Restart your system Install Docker from this link. Below is the version of my Docker Restart your system Start Docker for Windows, search Docker in the search bar in Windows. Make sure it is running. You should also go to Services.msc and make sure the services Docker Engine and Docker for Windows Service are running. At last, you must check your Nuget.config file from C:\Users\{Username}\AppData\Roaming\NuGet. For me, the content of that file was as below. <?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="nuget.org" value="https://api.nuget.org/v3/index.json" /> </packageSources> <packageRestore> <add key="enabled" value="True" /> <add key="automatic" value="True" /> </packageRestore> <bindingRedirects> <add key="skip" value="False" /> </bindingRedirects> <packageManagement> <add key="format" value="0" /> <add key="disabled" value="False" /> </packageManagement> </configuration> Hope this helps.