'DotNet NuGet push causes TLS error on PowerShell
We're facing a issue in our CI/CD pipeline to publish our package to Nuget.
Executing this command on PowerShell:
& dotnet nuget push "*.nupkg" --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
Causes the following output:
error: Não é possível carregar o índice de serviço para a origem https://api.nuget.org/v3/index.json.
error: The SSL connection could not be established, see inner exception.
error: Unable to read data from the transport connection: Foi forçado o cancelamento de uma conexao existente pelo host remoto..
error: Foi forçado o cancelamento de uma conexao existente pelo host remoto.
We already tried execute before:[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bOR [Net.SecurityProtocolType]::Tls12
and [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
We're using Windows Server 2012. Already changed the registry keys to use Tls12 too.
Edit:
MSFT Edge // IE
Solution 1:[1]
I solved the error weeks ago with the following registry keys:
reg add HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /v SystemDefaultTlsVersions /t REG_DWORD /d 1 /f /reg:64
reg add HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /v SystemDefaultTlsVersions /t REG_DWORD /d 1 /f /reg:32
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 | Gustavo Mauricio De Barros |


