Visual Studio 2010 nuget error: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel

Visual Studio-2010Web ConfigNuget

Visual Studio-2010 Problem Overview


Whenever I'm trying to install something or even just list the packages I get this error "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel"

I tried this solution from Codeplex with no luck.

I use the latest version of Nuget.

I also tried different options in devenv.exe.config like this:

<servicePointManager  checkCertificateName="false"    checkCertificateRevocationList="false"/>

Visual Studio-2010 Solutions


Solution 1 - Visual Studio-2010

  • Go to VS2010 → Tools → Library Package Manager → Package Manager Settings.

  • Choose Package Manager → Package Sources.

  • Add a new package source as:

  • Name: NugetSource

  • Source: http://packages.nuget.org/v1/FeedService.svc/

  • Move Up the newly added package source to first position.

  • UnCheck existing "Nuget official package source"

  • Restart VS2010.

Solution 2 - Visual Studio-2010

Go to https://nuget.org/ and get its certificate.

For example, if you're using Firefox: after opening nuget site - click site's icon on the left side of address bar, click 'More Information', and on the Security tab there should be 'Web-site identity' section with 'View certificate' button. Click there, in the opened dialog select Details tab - there you should see chain for *.nuget.org. Click button 'Export' at the bottom and save certificate to the file (add .cer extension manually, because dialog won't do it for you).

Now you need to setup you system so that it will trust the certificate. Press Win+R (Run dialog will be opened) -> type mmc there and run it (with admin privileges if you have UAC turned on). There select File -> Add or remove snapin... -> select Certificates on the left, in the dialog select Computer account and Local computer. Click OK - the tree will have Certificates node in the Console root. Open it and file folder Trusted People. From its context menu select All tasks -> Import... -> Select file that you have exported before and import it.

Everything should be working fine.

Solution 3 - Visual Studio-2010

We had the same issue in work, and we resolved this by dropping the secure socket, Https -> http. This means you can use the V2 URL http://nuget.org/api/v2/.

Possibly an issue getting rid of the secure socket, but the above URL (http://packages.nuget.org/v1/FeedService.svc/) is also unsecure.

Solution 4 - Visual Studio-2010

There's apparently an issue with the SSL cert on go.microsoft.com. Change the package source url to http://packages.nuget.org/v1/FeedService.svc/ and it should work just fine.

Solution 5 - Visual Studio-2010

Related: ServicePointManager does not support proxies with the https scheme

If you've previously had Fiddler open, you might well have a certificate for nuget.org that is invalid.

If so, open up MMC, add the Certificates snapin (current User) and remove nuget.org from the Personal store.

Example certificate to remove

Due to Nuget keeping a handle to this cert (seemingly) you will have to restart Visual Studio. Afterwards, you should have a good time.

Solution 6 - Visual Studio-2010

Go to VS2012 -> Tools -> Library Package Manager -> Package Manager Settings Choose Package Manager -> Package Sources.

  1. Add a new package source as: Name= NugetSource Source= http://packages.nuget.org/v1/FeedService.svc/
  2. Move Up the newly added package source to first position.
  3. UnCheck existing "Nuget official package source"
  4. Restart VS2012.

This is working on my machine.

Solution 7 - Visual Studio-2010

As of today 21-Jan-2015, the correct url is https://www.nuget.org/api/v2/. The www is required or the certificate fails. Do NOT fall back to http because you are opening your code and all of its consumers to a nasty MITM vector.

Solution 8 - Visual Studio-2010

If nothing from above works, try this....

Try pasting the following into a .reg file and run it. Then try running your NuGet command (no reboot required).

> Windows Registry Editor Version 5.00 > > [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\v4.0.30319] > "SchUseStrongCrypto"=dword:00000001 > > [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft.NETFramework\v4.0.30319] > "SchUseStrongCrypto"=dword:00000001

Ran into this issue because TLS1.2 was not enabled (similar to Tony's response). Using http does not fix the situation because NuGet redirects to https now that TLS1.2 is enforced.

thanks to "neoscribe"

Solution 9 - Visual Studio-2010

For me the problem was solved by clearing the nuget cache (and restarting VS)

https://i.stack.imgur.com/iR5WM.png" width="500" height="290">

Solution 10 - Visual Studio-2010

I could solve this problem by dropping the secure socket, https -> http. Go to Tools -> Nuget Package Manager -> Package Sources, then add a new source, but without https:

This means http://nuget.org/api/v2/.

Solution 11 - Visual Studio-2010

I had to remove https in Local machine settings for Nuget and added (http) it to user level in Tools -> Library Package Manager -> Package Manager Settings Choose Package Manager -> Package Sources.

Solution 12 - Visual Studio-2010

i have had no luck with any method related to Visual Studio. Not updating everything, not manually adding the Root Certificate of https://api.nuget.org/v3/index.json to windows, etc. How I fixed it:

nuget restore MySolution.sln

Download nuget here.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionchemarkView Question on Stackoverflow
Solution 1 - Visual Studio-2010SunilView Answer on Stackoverflow
Solution 2 - Visual Studio-2010Ivan DanilovView Answer on Stackoverflow
Solution 3 - Visual Studio-2010Christian PhillipsView Answer on Stackoverflow
Solution 4 - Visual Studio-2010anandView Answer on Stackoverflow
Solution 5 - Visual Studio-2010AndyElastacloudView Answer on Stackoverflow
Solution 6 - Visual Studio-2010chandanView Answer on Stackoverflow
Solution 7 - Visual Studio-2010psaxtonView Answer on Stackoverflow
Solution 8 - Visual Studio-2010AlejandroDGView Answer on Stackoverflow
Solution 9 - Visual Studio-2010JBSnorroView Answer on Stackoverflow
Solution 10 - Visual Studio-2010VladimirView Answer on Stackoverflow
Solution 11 - Visual Studio-2010jayView Answer on Stackoverflow
Solution 12 - Visual Studio-2010kellogsView Answer on Stackoverflow