No Connection with SSL/TLS secure channel

McDonald, Ronald 20 Reputation points
2024-03-04T14:56:46.04+00:00

I am using Microsoft Visual Studio Professional 2022 (64-bit) Version 17.8.6. When I tried to get a nuget package or use Manage Extension I get an error message that "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel." If I click on the link in the below error message I am able to see data in the webpage.

[nuget] Failed to retrieve metadata from source 'https://azuresearch-ussc.nuget.org/query?q=&skip=0&take=26&prerelease=false&supportedFramework=net8.0-android34.0&supportedFramework=net8.0-ios17.2&supportedFramework=net8.0-maccatalyst17.2&supportedFramework=net8.0-windows10.0.19041&semVerLevel=2.0.0'.

An error occurred while sending the request.

The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

The remote certificate is invalid according to the validation procedure.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,061 questions
0 comments No comments
{count} votes

Accepted answer
  1. Tianyu Sun-MSFT 30,356 Reputation points Microsoft Vendor
    2024-03-05T08:07:19.99+00:00

    Hello @McDonald, Ronald,

    Welcome to Microsoft Q&A forum.

    Please try to enable the TLS1.2(run following commands in CMD) and then try to get a NuGet package again.

    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
    

    If this doesn’t work, please try following:

    1. Press Win + R, type regedit, navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319, add a new registry entry called SchUseStrongCrypto, set its type to DWord, set its value to 1.
    2. Follow this document: Clearing local folders to clean NuGet cache.
    3. Try to repair/update Visual Studio from VS Installer.
    4. If possible, try to open Developer Command Prompt for Visual Studio 2022, run devenv /ResetSettings to reset VS settings.

    Feel free to let us know if above methods work.

    Best Regards,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    2 people found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.