New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 31 - Encryption(ssl/tls) handshake failed) Mac OSX High Sierra 10.13.5 #26388
Comments
I am seeing the same issue running .NET Core 2.1.300. |
@corretge @moconchobhair Could you kindly download and install the .NET Core SDK 2.1.300 from the link above and try again. Mac OSX version
PowerShell Core Script$sqlStr = 'Data Source={SERVER_IP};Initial Catalog=master;Integrated Security=False;User ID={USER};Password={PASS};Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;'
$sqlConn = New-Object System.Data.SqlClient.SqlConnection($sqlStr)
$con = $sqlConn.Open()
Write-Output "Connection Open"
$strCmd ="SELECT @@VERSION,compatibility_level FROM sys.databases WHERE name = 'master';"
$sqlCmd = New-Object System.Data.SqlClient.SqlCommand($strCmd,$sqlConn)
$dataReader = $sqlCmd.ExecuteReader();
while($dataReader.Read())
{
Write-Output "SQLServer Version = " $dataReader.GetString(0)
}
$sqlConn.Close()
Write-Output "Connection Closed" PowerShell Core script outputPS /Users/dotnet/Desktop> pwsh ./gh_30147.ps1
Connection Open
SQLServer Version =
Microsoft SQL Server 2017 (RTM) - 14.0.1000.169 (X64)
Aug 22 2017 17:04:49
Copyright (C) 2017 Microsoft Corporation
Enterprise Edition (64-bit) on Windows 10 Enterprise 10.0 <X64> (Build 17134: )
Connection Closed
PS /Users/dotnet/Desktop> PowerShell Core versionPS /Users/dotnet/Desktop> pwsh --version
PowerShell v6.1.0-preview.2
PS /Users/dotnet/Desktop> $PSVersionTable
Name Value
---- -----
PSVersion 6.1.0-preview.2
PSEdition Core
GitCommitId v6.1.0-preview.2
OS Darwin 17.6.0 Darwin Kernel Version 17.6.0: T...
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
.NET Core version and infoPS /Users/dotnet/Desktop> dotnet --version
2.1.300
PS /Users/dotnet/Desktop> dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.1.300
Commit: adab45bf0c
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.13
OS Platform: Darwin
RID: osx.10.13-x64
Base Path: /usr/local/share/dotnet/sdk/2.1.300/
Host (useful for support):
Version: 2.1.0
Commit: caa7b7e2ba
.NET Core SDKs installed:
2.1.300 [/usr/local/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
|
@corretge @moconchobhair Did you get a chance to test the connection with the latest version of .NET Core SDK 2.1.300 ? |
I am still seeing this issue on High Sierra 10.13.5 The new version of sql ops studio I downloaded fixed the issue, but I can't seem to get a .net core app to use Entity Framework to connect to a data (the same error as above and the same error I was seeing in Sql Ops Studio before I upgraded). I've tried updating all my packages in my proj file to the absolute latest nuget version with no luck:
|
I have the same sort of issue. With a plain vanilla project (.net core 2.1) deployed to a CentOS Box with entity framework I receive the same stacktraces in my application as soon as it is trying to connect to SQL server (it's on the same box). I tried localhost, 127.0.0.1, domain, but all give the same error. Connecting from Windows with SQL Server Management studio works fine, so this must be an issue in the tooling / runtime available for linux or mac osx |
@corretge @moconchobhair Do you still see this issue with PowerShell Core as initially mentioned ? @mcblakeb Could you kindly share a repro for the issue, I am unable to repro this in my environment even @las3r I was able to successfully connect using both localhost and 127.0.0.1 with:
Could you kindly share:
|
Hi @keeratsingh the same issue on the CentOS 7 sdk 2.1.302 net core 2.1.2 Was problem with nuget v3 but fix DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=false works. And now Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.design/index.json'. System.Data.SqlClient.SqlException : A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 31 - Encryption(ssl/tls) handshake failed) |
Hi @bartonjs, @saurabh500 mentioned you might be able to guide us in the right direction on how to tackle this issue. Any suggestions/ideas ? |
Workarounds mainly involve fixing the contents of the cert store directory. |
Sorry @keeratsingh, I tested it but did not answer 😱 I have the same issue:
dotnet version: 2.1.300 But now I can connect with the last version of SQL Operations Studio. Maybe this info helps. |
@corretge @moconchobhair @mcblakeb |
@keeratsingh It does indeed appear to be fixed after installing 2.1.302 on Mac. I had to update all projects over use netcoreapp2.1 as well. |
@keeratsingh I am able to successfully connect to all of my databases. Thank you so much! |
Thank you for confirmation. I will go ahead and close this issue. Feel free to reopen if the issue still exists. |
@keeratsingh the issue still exists.
|
Hello, I am still having this issue on centos 7 with net core sdk 2.1.302: os version
net core version
systemd service definition
if the user running the service is set to root then there is no exception thrown, with any other user this exception is thrown:
|
Thanks @jsgbrl ! root help me. |
This affects me as well, but the Ec2 that we're running doesn't have access to the root account. Our only option is a service account with sudo rights. |
I was having this issue connecting to SQL running in a docker container via SQL Ops Studio on my laptop running Ubuntu 16.04 (logged as a bug here: - microsoft/azuredatastudio#2150). It was resolved by running: - |
You can set TLS 1.0 to fix this. Also , this problem can be related to a firewall in the middle that is doing SSL inspection. I Suggest you either try again using another connection not doing SSL inspection, or ask your firewall admin to create an exemption for the source and/or destination you are connecting to, Cheers! |
I am having this issue on Net core 2.2 |
Getting this on 3.1.5 with an Azure SQL server (AspNetCore.HealthChecks.SqlServer with both Microsoft.Data.SqlClient 1.1.3 and 2.0.0) |
Sorry, my mistake getting |
I got this error last week following change of one of our application to upgrade dot net core 3.1. Look like default behavior has changed between 2.2 and 3.1 Hope that will help you |
I don't know if this was related to the core issue but my connection string had "database=blah" and changing it to "initial catalog=blah" fixed it for me.
|
In PowerShell I try to test an SQL connection from a Mac OSX 10.13.5. DotNet Core and PowerShell were installed through homebrew.
And I get this error:
dotnet --version : 2.1.300
$PSVersionTable
The text was updated successfully, but these errors were encountered: