Visual Studio cannot connect to Nuget.org on Windows 7

316 Views Asked by At

I'm using Windows 7 x64 and recently Visual Studio stopped working with nuget.org. Now it reports this error: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

I searched, tried everything from this similar topic: nuget.org: Unable to load the service index

I read this article about Deprecating TLS 1.0 and 1.1 on NuGet.org: https://devblogs.microsoft.com/nuget/deprecating-tls-1-0-and-1-1-on-nuget-org/#ensuring-your-system-uses-tls-1-2

I ensured my system has kb2533552 и kb3140245 installed and also checked the necessary values exist in the registry "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client"

Still, after all this I am unable to use the Package Manager. I can access https://apiint.nugettest.org/v3-index/index.json from the browser, but I cannot make the following c# code work - it still throws an exception:

var client = new HttpClient();
string uri = "https://apiint.nugettest.org/v3-index/index.json";
var response = await client.GetAsync(uri);
string msg = "If you see this, your machine has no TLS/SSL issues with nuget.org";
Console.WriteLine(msg);
1

There are 1 best solutions below

4
Dev Chris On

I had the same problem. I was also unable to check for updates in the extensions and updates dialog.

It started working again when I added the following cipher suites to the machine and rebooted:

TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384

This can be done via Group Policy -> Computer Configuratiom -> Administrative Templates -> Network -> SSL Configuration Settings -> SSL Cipher Suite Order, but can also be found in the registry at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Cryptography\Configuration\Local\SSL\00010002 in the Functions value