Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to load the service index for source https://api.nuget.org/v3/index.json in VS2017?

Tags:

I am getting this error:

[nuget.org] Unable to load the service index for source https://api.nuget.org/v3/index.json. An error occurred while sending the request. Unable to connect to the remote server A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 185.82.212.95:8080

like image 735
Ajit Pawar Avatar asked Sep 30 '17 06:09

Ajit Pawar


People also ask

What is index JSON NuGet?

The service index is a JSON document that is the entry point for a NuGet package source and allows a client implementation to discover the package source's capabilities.

Where is NuGet EXE?

Create a Symbolic Link here: %localappdata%\microsoft\winget\links. Make the nuget.exe globally available for your user to call it from anywhere, since the aforementioned directory should be present in your user's PATH variable.

What is a NuGet package?

Put simply, a NuGet package is a single ZIP file with the . nupkg extension that contains compiled code (DLLs), other files related to that code, and a descriptive manifest that includes information like the package's version number.


2 Answers

I was having same issue in VS 2017. You would need to enable proxy settings for VS, so that it can use existing IE proxy to reach out internet. This is especially useful, for those users, who uses office laptops and proxy settings are managed by group policies and IE settings get updated automatically. It would have been great if there was an option within VS IDE itself to add proxy just like Eclipse IDE has.

Solution

  1. Go to your Visual Studio install location as below -

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE

  1. Open devenv.exe.config file as an Administrator.

Add defaultProxy tags as below, within the existing system.net tag -

<system.net>     <defaultProxy enabled="true" useDefaultCredentials="true">         <proxy usesystemdefault="true" bypassonlocal="true" />     </defaultProxy>   <settings>     <ipv6 enabled="true"/>   </settings> </system.net> 
  1. Restart VS.
like image 81
Indranil Avatar answered Oct 12 '22 12:10

Indranil


TLDR ;)

FYI: the same issue is still happening for VS 2019 Version 16.6.3.


Ok, let's get started to fix this issue :)

First, you need to navigate the Visual Studio instance and for that do the following:

  1. Open Properties on VS shortcut and then click on "Open File Location"

    enter image description here

  2. Edit as administrator the devenv.exe.config with Notepad++ or other editors you prefer:

    enter image description here

  3. Navigate to the end of a file and check if you don't have <defaultProxy>... section:

    enter image description here

  4. Make sure to add following inside <system.net>:

   <defaultProxy enabled="true" useDefaultCredentials="true">       <proxy usesystemdefault="true" bypassonlocal="true" />    </defaultProxy> 

The final result should be like this:

enter image description here

A few notes:

  1. If you have several Visual Studio instances then make sure you edited devenv.exe.config for each one.
  2. Sometimes after VS updates, these files content can reset. So a good hint here is that once you Update Visual Studio instance, then go and check the .exe.config file.

Update: Btw, the same kind of approach work for many other applications, for example, check this post.

like image 21
Arsen Khachaturyan Avatar answered Oct 12 '22 12:10

Arsen Khachaturyan