11

When I press on "Browse" tab on NuGet packages in Visual Studio, it says "Error occurred" with an error message of

[nuget.org] Unable to load the service index for source https://api.nuget.org/v3/index.json.
  An error occurred while sending the request.
  The request was aborted: Could not create SSL/TLS secure channel.

I have been using Visual Studio and NuGet for a long time and NuGet was working a few days ago. Can someone figure out why this is happening and what I can do to solve it?

Visual Studio 2017 version: 15.9.17

M. Azyoksul
  • 1,580
  • 2
  • 16
  • 43
  • Hi friend, do you have any update for this issue? Please try my steps which l hope step two is helpful for you. Feel free to let us know if there's any update:) – LoLance Nov 27 '19 at 02:15
  • I solved the issue by changing a registry entry, proposed by someone in another thread. I will link it here when I get back. – M. Azyoksul Nov 27 '19 at 03:46
  • 2
    Might have been related to this: https://github.com/NuGet/NuGetGallery/issues/7705 – n0rd Jul 14 '20 at 01:06
  • 1
    please see https://devblogs.microsoft.com/nuget/deprecating-tls-1-0-and-1-1-on-nuget-org/ – yob Mar 02 '21 at 16:50
  • @n0rd's link has a workaround with reg keys that worked for me – Rafael Feb 22 '22 at 13:49

5 Answers5

17

NuGet has permanently removed support for TLS 1.0 and 1.1.

Ensure your system uses TLS 1.2.

Run the following commands to enable TLS 1.2 support if it is disabled:

reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v DisabledByDefault /t REG_DWORD /d 0 /f /reg:32
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v DisabledByDefault /t REG_DWORD /d 0 /f /reg:64
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v Enabled /t REG_DWORD /d 1 /f /reg:32
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v Enabled /t REG_DWORD /d 1 /f /reg:64
Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
Vladislav
  • 1,696
  • 27
  • 37
  • 2
    at first i ignored this solution because i didn't have the TLS 1.2 regisrty key in my machine. but in my case, adding the key and setting it as above solved the problem – maozx May 24 '21 at 09:15
  • 1
    You may need to add the DotNet reg keys `reg add HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /v SystemDefaultTlsVersions /t REG_DWORD /d 1 /f /reg:64` and `reg add HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /v SystemDefaultTlsVersions /t REG_DWORD /d 1 /f /reg:32` – Rafael Feb 22 '22 at 13:46
1

I have been using Visual Studio and NuGet for a long time and NuGet was working a few days ago. Can someone figure out why this is happening and what I can do to solve it?

The issue could be more related to network, nuget cache conflicts or even nuget agent. So there are a number of factors that can contribute to this problem. After my research, many users are facing the same problem as yours. To troubleshoot it, please follow my suggestions:

Suggestions

  1. clean the nuget cacheto eliminate cache interference.

  2. select Available package source(Tools-->Options-->Nuget Package Manager-->Package Source) and add a new source link like http://packages.nuget.org/v1/FeedService.svc/. In this point, change a service point to check whether the network interference the previous service link.

  3. try to add proxy settings into Nuget.Config file. Refer to this link for details: Nuget Config Section & Nuget Proxy Settings.

More information you can refer to this.

In addition, if VS2019 is not the latest version, please update it to the latest version.

If your issue still persists, please feel free to let us know.

LoLance
  • 25,666
  • 1
  • 39
  • 73
  • 2
    Proper package source for nuget.org is `https://api.nuget.org/v3/index.json`. The one mentioned in the answer is something really ancient and should not be used in any modern system. – n0rd Jul 14 '20 at 01:04
0

I had same problem and my solution is "Download and add certificate to Windows Certificate Manager"

  1. Certmgr.msc
  2. Import certificate in Local Computer -> Trusted root certificate authorities
  3. Reboot

0

I was using TLS1.2 but missing a compatible cipher suite. You can test what TLS and ciphers nuget use via: https://www.ssllabs.com/ssltest/analyze.html?d=api.nuget.org and you can test what ciphers you have installed (but no necessarily enabled) on your host via: Get-TlsCipherSuite or Get-ItemPropertyValue -Path HKLM:\SYSTEM\CurrentControlSet\Control\Cryptography\Configuration\Local\SSL\00010002 -Name Functions

timB33
  • 1,977
  • 16
  • 33
0

What worked for me is

Save the below snippet to a reg file and run it

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
Nayas Subramanian
  • 2,269
  • 21
  • 28