When I run dotnet restore --interactive it keeps sending this error:
error NU1301: Unable to load the service index for source https://www.nuget.org/api/v3/index.json
But when I checked out my source configration in Nuget management, it is https://api.nuget.org/api/v3/index.json and it can be opened through browser.
How can I change that url to the correct one?
I can see in .nuget/nuget/nuget.Config the packageSource settings has the line with:
key="nuget.org" value="https://api.nuget.org/v3/index.json" protocalVersion="3"
But when I go restore nuget packages, it is still hitting https://www.nuget.org/api/v3/index.json. Why? Are there any other files I missed to change?
According to the documentation's article NuGet Error NU1301:
And the last sentence worked for me. No detailed error message was available, even with dotnet restore --verbosity detailed. The first source owner is not interested in support, and the current (my company) knows nothing more. So I disabled this source for this particular project with dotnet nuget disable source <source_name>, and yes, the source was not necessary.
My team was facing the same issue restoring within docker compose even for https://api.nuget.org/v3/index.json. As hinted at in comments from @Levi Fuller and @PicoutputCls, this was a DNS issue. In our case, though, it wasn't a private nuget source nor was our IT team blocking container requests (to my knowledge?). Ultimately, to resolve the issue, we had to set the DNS in our Docker Engine configuration:
{
...,
"experimental": false,
"dns": [
"10.1.2.3",
"8.8.8.8"
]
}
What DNS entries you use is up to you; we used our network's private DNS with a fallback on Google, but YMMV.
Interestingly, curl https://api.nuget.org/v3/index.json worked just fine...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With