[英]Nuget Restore - The remote name could not be resolved
I am having a problem with Nuget Restore (occurs in VS 2015/2017 and using nuget on command line).我在使用 Nuget 恢复时遇到问题(发生在 VS 2015/2017 中并在命令行上使用 nuget)。 I get the following error:
我收到以下错误:
Unable to load the service index for source https://api.nuget.org/v3/index.json.
An error occurred while sending the request.
The remote name could not be resolved: 'locahost'
I guess the issue is with the apparent typo in ' locahost
', but I'm not sure where this value is coming from?我想问题出在“
locahost
”中明显的拼写错误,但我不确定这个值是从哪里来的?
My Nuget config in %AppData%/Roaming/Nuget looks like this:我在 %AppData%/Roaming/Nuget 中的 Nuget 配置如下所示:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<packageSources>
<clear />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
</packageSources>
<disabledPackageSources />
<activePackageSource>
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
</activePackageSource>
</configuration>
Where else could this be coming from?这还能从哪里来?
This was resolved by configuring nuget to use a proxy:通过将 nuget 配置为使用代理解决了这个问题:
nuget.exe config -set http_proxy=<proxy-url>:<port>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.