Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package Manager Error: Unable to load the service index for source (bad proxy settings) #2880

Closed
klaykuban opened this issue Jun 1, 2016 · 74 comments
Labels
Resolution:External This issue appears to be External to nuget
Milestone

Comments

@klaykuban
Copy link

nuget

Following error received when searching for packages in the package manager

[nuget.org] Unable to load the service index for source https://api.nuget.org/v3/index.json.
Invalid URI: Invalid port specified.

@rrelyea
Copy link
Contributor

rrelyea commented Jun 6, 2016

What version of NuGet are you using in VS?
can you please send a fiddler trace to support@nuget.org

This is likely a bad proxy, or an older version of NuGet?

@klaykuban
Copy link
Author

NuGet package Manager v 3.4.4.1321

How can I find the fiddler trace? I'm fairly new to visual studio and such.

@dmantovani73
Copy link

Today I'm experimenting the same problem (in the past few days everything worked fine). If I run Fiddler I don't see any HTTP call but I got the error. What can I do?

Thanks

@klaykuban
Copy link
Author

I finally ran Fiddler and saw the same. No HTTP but have the error

@dmantovani73
Copy link

Finally I found the issue, at least in my case: if no Windows HTTP proxy is specified, NuGet uses (if present) the HTTP Proxy specified in the environment variable http_proxy.

@klaykuban
Copy link
Author

Were you able to fix the issue?

@dmantovani73
Copy link

Yes, removing the env var http_proxy fixed the issue (in my case).

@klaykuban
Copy link
Author

Sorry i'm not too familiar with how to do that. How can i remove that env var?

@dmantovani73
Copy link

Open "System Properties" > Advanced > Environment Variables. Find the http_proxy var (in System variables), select and delete it.

@klaykuban
Copy link
Author

Incredible. It worked! Thanks big time. I've been stuck at this point for well over a month

@rrelyea rrelyea changed the title Package Manager Error: Unable to load the service index for source Package Manager Error: Unable to load the service index for source (bad proxy settings) Jun 28, 2016
@nkuhan
Copy link

nkuhan commented Sep 9, 2016

In mac os x shell I typed
export ALL_PROXY=proxy ip address :port number
then typed
dotnet restore
It's work fine

@KasunKoswattha
Copy link

For me, a simple VS restart fixed the issue.

@zchpit
Copy link

zchpit commented Jan 5, 2017

In my computer I should go to catalog:
C:\Users\myUserName\AppData\Roaming\NuGet

And edit NuGet.xml file:

Working file looks like this:

Uploading NuGet.txt…

@HydTechie
Copy link

  1. Copy Nuget.exe by any peer projects via copying .nuget folder to "NONWorking" project folder..
  2. In windows, IE has proxy settings, some times its gets checked for no great reason... uncheck, if you dont use proxy.
  3. restore the solution in VS 2015.. I got it resolved on my machine.

@vsg24
Copy link

vsg24 commented Jan 23, 2017

For me removing the .nuget folder located in C:\Users\YourNameHere fixed the problem.

@mishrsud
Copy link

@vsg24 Thanks a ton! Removing .nuget from my profile (C:\Users<username>.nuget) worked like a charm!

Environment:
Windows 10 Pro RTM x64
dotnet SDK version 1.0.0-rc4-004771
Shell: Native Windows Command Shell

@microsmith
Copy link

My issue was simple... my virtual machine lost internet connectivity!

@shafatahmad
Copy link

Can somebody help me with this issue? I am not using any kind of proxy and I have a brand new install of VS 2017 ..

[nuget.org] 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: 'api.nuget.org'
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: 'api.nuget.org'
Time Elapsed: 00:00:38.4173999
========== Finished ==========

``
![using package manager console](https://cloud.githubusercontent.com/assets/16449737/26712265/b29657ce-4783-11e7-9768-64c8d9849dfc.png)
`

@d-arkhipenko
Copy link

Hi all, if you use Ubuntu server, this error fixed by install : https://www.howtoinstall.co/en/ubuntu/xenial/libcurl3

@9Rune5
Copy link

9Rune5 commented Jun 21, 2017

Would be nice if the error message could say "cannot reach 93.184.221.200" or similar (basically tell me which host or IP that couldn't be reached).

Today our IDS had blocked nuget, because it believed the nuget host had performed a port scan on us. I doubt that is likely (far more likely that our frequent builds trigger lots of traffic to the nuget servers and this confused a poorly configured IDS).

In any case..: A nicer error message would have sorted out our problem faster.

@solomon1271
Copy link

Restarting VS works for me too.

@tyeth
Copy link

tyeth commented Aug 1, 2017

Had no environment variables mentioned here, was using new .Net IDE called Rider, on ubuntu, libcurl3 was already present.

Ended up setting the IDE to use a proxy and then saved and then set to no proxy and saved.
Solved.

Thought it was a versioning issue as I'm using an old vs2015 project, but even changing the version used by project didn't help. Although it resolved a separate issue for me as mono supported .net >=4.5 and I had it targetting 4.5 but forgot I needed a nuget package thats linked to 4.6 :)

@AndreiRinea
Copy link

AndreiRinea commented Sep 26, 2017

Had the same issue today, removed .nuget folder from my profile folder and it started working again. The other things before (env var etc.) didn't work.

@Luca4k4
Copy link

Luca4k4 commented Sep 28, 2017

Hi, i've the same problem.. I tryed to remove .nuget folder but it is still not working. In my environment variables i did not find any http_proxy var. I've this problem for days, please help me to solve it! :(

@VishalTank3010
Copy link

I have the same problem. Can I manually download and install the package in my project?
Actually, I have installed the same package( Which I want in a new project but this problem sucks) in another project, So is there any way to use it in another project directly?

@VishalTank3010
Copy link

Go for Settings ( Global Settings of your PC ) > Network and Internet > Proxy > Automatic Proxy Setup > and set Automatically detect settings to off. This Works for me.... Try this ...

@Luca4k4
Copy link

Luca4k4 commented Sep 30, 2017

I solved the problem! Thank you @VishalTank3010

@alensiljak
Copy link

@microsmith, thank you for the hint! In my case it was the firewall!

@shiro997
Copy link

shiro997 commented Nov 5, 2019

I tried to remove the .nuget folder located in C:\Users\YourNameHere and the error continues, what can I do in that case?, I'm working in vs 2019

@AndnixSH
Copy link

AndnixSH commented Nov 20, 2019

For me, open Fiddler 4 temporary fixed the problem but closing it causing error again.

@AndnixSH
Copy link

This trick solved the problem https://stackoverflow.com/a/58851687/3763113

@Rugved
Copy link

Rugved commented Feb 1, 2020

This worked for me

  1. Close the visual studio
  2. delete .vs folder from the root of your project
  3. Re open the visual studio and compile.

@feboz
Copy link

feboz commented Mar 19, 2020

I had recently installed/uninstalled Fiddler and was getting this error and ended up having to add defaultProxy settings back to C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe.config
https://stackoverflow.com/questions/46500032/unable-to-load-the-service-index-for-source-https-api-nuget-org-v3-index-json?rq=1

Great! That worked for me! Thank you

@rsmartapps
Copy link

@vsg24 Thanks a ton! Removing .nuget from my profile (C:\Users<username>.nuget) worked like a charm!

@Insighter2k
Copy link

Just wanted to point out an additional tip. I have struggled as much as you guys, but the problem was that the docker image does not know my proxy server. It cannot resolve any dns entry, so I have added the HTTP_PROXY / HTTPS_PROXY to my dockerfile as arguments with the ip-address instead of the dns name.

ARG HTTP_PROXY=http://<ip>:<port>/
ARG HTTPS_PROXY=http://<ip>:<port>/
FROM [...]

@kaceper11
Copy link

This worked for me

  1. Close the visual studio
  2. delete .vs folder from the root of your project
  3. Re open the visual studio and compile.

Worked for me

@BorisTeskera2019
Copy link

BorisTeskera2019 commented Feb 15, 2021

I have the same issue as you and I try all possible combination from internet bu my error is still active.
When I try to build I get error:
Error occurred while restoring NuGet packages: Unable to load the service index for source https://api.nuget.org/v3/index.json.

and on > dotnet restore I get error:
PM> dotnet restore
Determining projects to restore...
Restored C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MyProjects2019\source\repos\Bank\Bank\Bank.csproj (in 348 ms).
C:\Program Files\dotnet\sdk\5.0.103\NuGet.targets(131,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:\Program Files (x86)\Microsoft V
isual Studio\2019\Community\MyProjects2019\source\repos\Bank\Bank.sln]
C:\Program Files\dotnet\sdk\5.0.103\NuGet.targets(131,5): error : The SSL connection could not be established, see inner exception. [C:\Program Files (x86)\Microsoft Visual Studio
2019\Community\MyProjects2019\source\repos\Bank\Bank.sln]
C:\Program Files\dotnet\sdk\5.0.103\NuGet.targets(131,5): error : The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot [C:\Program Files (x86
)\Microsoft Visual Studio\2019\Community\MyProjects2019\source\repos\Bank\Bank.sln]
PM>
What is strange I see in NuGet package all installed package that I need in VS2019 but yellow question mark is on all needed package.

I don't know what more I can try, please any tips, help.
I use VS 2019 Community Edition.

Thanks & Regards
VS2019 Error

@kimdungoc
Copy link

Finally I found the issue, at least in my case: if no Windows HTTP proxy is specified, NuGet uses (if present) the HTTP Proxy specified in the environment variable http_proxy.

You save my life bro.

@stephen-pilli
Copy link

If in Linux, I was able to get restore working on my Solus box by first running
export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0. Once I did that, dotnet restore worked.

export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0 
dotnet restore

worked well with new ue5 early access on linux.

@Lecarvalho
Copy link

I tried a lot of things you guys said but that just works when I restart the pc.

I don't know if it's related but I was connected to a vpn just before the error started.

Using vscode in Ubuntu with Dev Container

MikaelMayer added a commit to dafny-lang/dafny that referenced this issue Nov 8, 2021
@RLashofRegas
Copy link

Would appreciate if anyone could help me: https://serverfault.com/q/1101866/563885 seems I have the same setup as @Lecarvalho (Ubuntu in Dev Container) but his fix appears to be "it magically started working again". I'm on a company laptop but not on a VPN. Possible my company has some sort of redirect that's messing up from within the container, but not sure how to figure that out.

@AlFalahTaieb
Copy link

@RLashofRegas did you fixed it ?

@RLashofRegas
Copy link

@AlFalahTaieb no, I was not able to fix it. I have resorted to using a GitHub Codespace as it doesn't have the same problem.

@KohrAhr
Copy link

KohrAhr commented Jul 14, 2022

Still doesnt work with VS2019/VS2022

@SBANASGH
Copy link

I had the same problem after upgrading to vs2022 17.4.0 preview 2.1. It can be accessed in the browser, and the dotnet restore command is also normal, but accessing the Nuget package manager and restore in VS fails.

@hassanshamshir
Copy link

What will be in case of Dockerfile for window image?

@hassanshamshir
Copy link

I am getting the following error while running MVC .Net Framework application while building docker images by using Dockerfile.

@matusqo
Copy link

matusqo commented Nov 4, 2022

Same error occured all of a sudden an 30 minutes ago without any warning, nothing changed, in the middle of development! I tried VS2019 and it works for the same sln file

@umeshgit12997
Copy link

one of the classic reason...

Possible Problem: Stale Artifactory Credentials in Credential Manager
You have saved credentials for your artifactory in credential manager. If your system/SSO credentials changed recently then this will happen.

Solution: Update/Remove Saved credentials from Credentials Manager
Go to Windows => Credentials manager => Windows Credentials => Generic Credentials => [Artifactory related Credentials] => Remove.

When you rebuild from visual studio it will again ask for fresh credentials. It's upto you whether want to save or add every time.

Credential manager - 1

Enter credentials after rebuild in VS 2

@adamcole123
Copy link

FOR WINDOWS MACHINES

Try all of these and it something will fix it:

  • Remove http_proxy from your environment variables (type env into your windows search and it will take you to the settings menu that you need)
  • In your windows proxy settings, set automatically detect proxy settings to off
  • Turn off windows firewall by going to Windows Defender and for each of the firewall settings disable them

This SHOULD work, if it doesn't then the solutions that you will find by typing "error NU1301: Unable to load the service index for source https://api.nuget.org/v3/index.json." into Google will work.

@parth211prajapati
Copy link

parth211prajapati commented May 17, 2024

facing Nuget problem, This issue i facing Only MAUI Project.(https://api.nuget.org/v3/index.json This URL Proper Work on browser )
[nuget.org] Unable to load the service index for source https://api.nuget.org/v3/index.json.
An error occurred while sending the request.
The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
The remote certificate is invalid according to the validation procedure.
331588386-4dfc76e7-5071-4f80-bd54-19febff8bf9b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution:External This issue appears to be External to nuget
Projects
None yet
Development

No branches or pull requests