The request was aborted: Could not create SSL/TLS secure channel.

Context:

In a new .NET Core project , trying to add  nuget packages.

Error:

[nuget.org] Failed to retrieve metadata from source 'https://azuresearch-ussc.nuget.org/query?q=&skip=0&take=26&prerelease=false&supportedFramework=.NETCoreApp,Version=v3.1&semVerLevel=2.0.0'.

  An error occurred while sending the request.

  The request was aborted: Could not create SSL/TLS secure channel.


Cause/Solution:

TLS 1.2 was enabled at

HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols

So, that was not the issue. 

Next, I just upgraded Visual Studio  2019 to latest update version 16.11.15 and the error was gone.

In another scenario, I received the same error while using Sharepoint CSOM in c# code. In this case, I noticed that httpruntime under <system.web> in the web.config didn't have targetframework version, when i set it to 4.8, the error was gone.

 <httpRuntime targetFramework="4.8" maxUrlLength="324" />

Comments