NuGet does not work: "The connected connection was closed: an unexpected error occurred while sending",

I want to install Microsoft ASP.NET Identity Core using Manage Nuget Packages, but when I click the install button, the following error occurs:

The connected connection was closed: an unexpected error occurred while sending

+6
source share
5 answers

This is an SSL certificate issue at http://go.microsoft.com . Change the package source URL to http://packages.nuget.org/v1/FeedService.svc/ , which works for me.

Source: https://nuget.codeplex.com/discussions/275537

+8
source

This can happen if your firewall is doing SSL checking. You may need a white repo list.

+1
source

This can also happen if you did not enable TSL 1.0 (disabled by default in Server 2012R2). In this case, you can see that some packages were successfully installed before you click "The connected connection was closed: An unexpected error occurred while sending failed."

For more detailed error information, run nuget install from the command line using "Detailed Detailed Description"

i.e.

System.Net.WebException: The main connection was closed: unexpected or occurred while receiving. ---> System.ComponentModel.Win32Exception: the client and server cannot communicate because they do not have a common algorithm

+1
source

This is usually due to the fact that the web server does not have a valid SSL certificate. An invalid SSL certificate may be caused by being self-signed and not trusted by the CA, or the certificate has been revoked by the CA.

Using an unauthenticated URL can be a workaround for the problem, but the solution to the problem is that the SSL certificate is valid.

0
source

Try pasting the following into a .reg file and run it . Then try running the 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 

Faced this problem because TLS1.2 was not enabled (similar to Tony's answer). Using http does not help in remedying the situation, because NuGet redirects to https now that TLS1.2 is applied.

0
source

All Articles