Error: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

Oct 12, 2011 at 3:34 AM


Searching the web didn't yield a single relevant result.. A review of the results I did get show that this error isn't NuGet specific, but still, maybe you fine people are already aware of it and have a solution.

See below a snippet from my VS2010 (using the Package Manager console):

PM> install-package EntityFramework
Install-Package : The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
At line:1 char:16
+ install-package <<<<  EntityFramework
    + CategoryInfo          : NotSpecified: (:) [Install-Package], WebException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand


Oct 12, 2011 at 3:39 AM

There's apparently an issue with the SSL cert on Change the package source url to and it should work just fine.

Oct 12, 2011 at 3:48 AM

Hi mate! Worked like a charm!

So the default one is nothing more than a redirect to the URL you suggested.

Cool, going to remove the original one, no point in keeping it. Or is there?? :)


Oct 12, 2011 at 12:03 PM

This is weird, I had the same problem, now everything is showing correctly and I did not do a thing other than restart my computer!! 

Oct 12, 2011 at 4:23 PM

It's git fixed when the cert was renewed. The restart was probably incidental :)

Oct 12, 2011 at 4:49 PM

This happened to me last night but didn't happen to me this morning. The odd thing was that it seemed like it only happened when I did a Publish, not a Build. My error was a bit different:

    "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel."                                                                                                                                                                         NuGet.targets

    The command "C:\dev\TheProjectName\src\.nuget\nuget.exe" install "c:\dev\TheProjectName\src\packages.config" - source "" -o "c:\dev\TheProjectName\src\packages" exited with code 1.                           Nuget.targets

Oct 17, 2012 at 11:52 AM

While this thread seems to have resolved the problem I believe that there is one other possible cause for this error to occur.  I was getting the error (... relationship for the SSL/TLS secure channel) on my build machine (Win Server 2003).

I logged on to the build machine using the TFS build service account. I checked the certificates and all seemed to be in order.  When I opened the URL ( directly in the browser (IE 6) I got a warning that indicated that I was opening a secure connection. After I ticked the box that says don't ask about this again the xml displayed.

After disabling the warning the builds work just fine with the URL.

It may be that the warning caused the connection to fail with the ...SSL/TLS... error.


Oct 17, 2012 at 4:57 PM

You could always try using the non-SSL endpoint ( I suppose. 

May 5, 2014 at 1:04 PM
Thank you very much @dfowler. I had the same problem and now it is solved. :)
Nov 12, 2014 at 7:47 AM
Hi All,

I am facing the same issue like
The underlying connection was closed: The connection was closed unexpectedly.

I am publishing the package to Octopus deployer(http://[Servername]/nuget/packages )using NuGet.exe.

Any suggestions.

Thanks in advance,
Mar 3, 2015 at 12:10 PM
Edited Mar 3, 2015 at 1:25 PM
DWinx's suggestion did not work for me. It got the browser to work but not the build via CruiseControl.NET. Had to go to HTTP. Editing configs under app data did not work. I am on Windows Server 2003 with Visual Studio 2010. I opened up visual studio->Tools->Library Package Manager->Packager Manager Settings->Package Sources.

Add a package source (I called mine "NuGet official package source HTTP" with a URL of ""
Then move it up the list so it is the first source listed.