Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The underlying connection was closed: An unexpected error occurred on a send.--- NuGet

Whilst trying to restore nuget packages I am getting the following:-

Error 1 The underlying connection was closed: An unexpected error occurred on a send.

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

Error 3 The command ""D:\root\.nuget\NuGet.exe" install "D:\root\packages.config" -source "" -NonInteractive -RequireConsent -solutionDir "D:\root\"" exited with code 1.

Error 4 Metadata file 'D:\root\project.Website.dll' could not be found D:\root\project.UnitTests\CSC

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

I tried the solutions provided on: https://nuget.codeplex.com/discussions/275537

None of them work, I was wondering if anyone else is currently having this issue? If so has anyone come up with a solution?

It seemingly, may be a waiting game, for the SSL certificates to be fixed.

After some further debugging with Fiddler I got the following response:

fiddler.network.https> HTTPS handshake to az320820.vo.msecnd.net failed. System.IO.IOException Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. < An existing connection was forcibly closed by the remote host

If I am correct, it seems like I am being rejected but the server, not sure why and I am hopeful this will soon resolve it self.

For now I have managed to get copies of packages from other developers who hadn't cleared their package cache and continue developing this way.

Someone has kindly raised the issue on code plex so hopefully we get somewhere soon: https://nuget.codeplex.com/workitem/4372

Update

As of 17th November, this seems to be working again. NuGet correctly telling me it's having issues getting an older version of Ninject.Web.Common.3.2.0.0 but we have the updated edition which is fine.

like image 576
Anicho Avatar asked Nov 14 '14 10:11

Anicho


People also ask

What does the underlying connection was closed mean?

[Solved] The underlying connection was closed: An unexpected error occurred on a receive. - CodeProject The underlying connection was closed: An unexpected error occurred on a receive.

What does NuGet error 1 mean?

NuGet - Stack Overflow The underlying connection was closed: An unexpected error occurred on a send.--- NuGet Bookmark this question. Show activity on this post. Error 1 The underlying connection was closed: An unexpected error occurred on a send.

What is an error in cTx?

Error appears when code executes to ctx.ExecuteQuery ();. The underlying connection was closed: An unexpected error occurred on a send. you can try check the below url to create new key on registry which may resolve the issue.

What happens when the server decides to close the connection?

When the server decides to close the connection, you'll get an error in your client code, and that is actually correct behavior of your client. If the server is also yours, check what the server is doing with that URL. Please Sign up or sign in to vote.


2 Answers

I'm seeing this issue behind a corporate proxy using Visual Studio 2015 which utilizes the new v3 API (https://api.nuget.org/v3/index.json). In my instance, it has to do with an SSL intercepting corporate proxy (BlueCoat) that doesn't know how to handle a newer cipher protocol (eg: TLS 1.2 plus some newer key exchange cipher) being negotiated by that API endpoint I believe.

like image 86
stephen_liu Avatar answered Sep 30 '22 19:09

stephen_liu


A quick fix for Visual Studio 2015 users is to change the URL from https to http. I have a feeling that this may not work if the package has a https license file.

Alternatively, switch to Visual Studio 2013 for package installation and updates.

like image 43
Kris Avatar answered Sep 30 '22 18:09

Kris