Visual Studio无法解析nuget的解决方法

  VS在使用nuget进行程序包管理时,经常出现“未能解析此远程名称:'nuget.org'”的情况,但是访问http://www.nuget.org/时正常。此时,可通过如下几种方式测试:

1、使用默认的本地DNS进行解析:在命令行下输入:nslookup nuget.org,如果解析出地址

C:WINDOWSsystem32>nslookup nuget.org 8.8.8.8
服务器: google-public-dns-a.google.com
Address: 8.8.8.8

非权威应答:
名称: nuget.org
Address: 168.62.110.126

  将ip地址添加到host中去。(host目录位置:C:WindowsSystem32driversetc )

2、使用google的OpenDNS 8.8.8.8或8.8.4.4,解析nuget.org

C:WINDOWSsystem32>nslookup nuget.org 8.8.8.8
DNS request timed out.
timeout was 2 seconds.
服务器: UnKnown
Address: 8.8.8.8

非权威应答:
名称: nuget.org
Address: 168.62.110.126

同样的,获取ip添加到host中去。

3、直接使用google的OpenDNS 8.8.8.8或8.8.4.4替换本机的DNS,将本机的DNS服务器地址由自动获取改为“8.8.8.8或8.8.4.4”,可也添加为备用 DNS。

4、使用其他OpenDNS替换本机默认DNS,以下提供一些免费的域名解析服务提供商:

208.67.222.222 (Resolver1.OpenDNS.com)

208.67.220.220 (Resolver2.OpenDNS.com)

208.67.222.220 (Resolver3.OpenDNS.com)

208.67.220.222 (Resolver4.OpenDNS.com)

OpenDNS还有另一个服务Family shield Server ,可以阻挡成人网站以及含有恶意软件的网站。

208.67.222.123 (resolver1-fs.opendns.com)

208.67.220.123 (resolver2-fs.opendns.com)

  以上部分内容来源于网络,经测试后整理。

原文地址:https://www.cnblogs.com/elic/p/4063887.html