'Could not create SSL/TLS secure channel while trying to search for NuGet packages

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



Solution 1:[1]

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

Solution 2:[2]

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.

Solution 3:[3]

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

Solution 4:[4]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Wai Ha Lee
Solution 2 LoLance
Solution 3 timB33
Solution 4 DMihaylcihenko