hsjeong
5μ 28, 2025, 7:55μ€μ
1
μλ
νμΈμ, λ·λ·μΌλ‘ κ°λ°μ€μΈ μ
λ¬Έμ μ
λλ€.
νμ¬ C# .NET 8.0 Avalonia UI λ₯Ό μ΄μ©νμ¬
Windows μ Linux (Ubuntu 22.04 / 24.04) μͺ½μμ λλ€ μ€νμ΄ κ°λ₯ν
νλ‘κ·Έλ¨μ λ§λλ € νλλ°,
MS SQL Serverμμ μ°κ²°μ μνμ¬ Microsoft.Data.SqlClient μ
SqlConnection μ μ΄μ©νμ¬ Open()μ νλ € νμ΅λλ€.
μ μνλ €κ³ ν
μ€νΈν SQL Serverλ μ΄ 3κ° μ
λλ€.
Microsoft SQL Server 2005 - 9.0.3077
Microsoft SQL Server 2008 R2 (SP2) - 10.50.4042.0 (X64)
Microsoft SQL Server 2022 - 16.0.1000
μ²μμλ
"
Error: 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)
" μ€λ₯κ° λ°μνμλλ°, μλ£λ₯Ό μ°Ύλ μ€
μλ
νμΈμ.
μ’μ κΈλ€ μ½κΈ°λ§ νλ€κ° μ§λ¬Έμ λλ € λ΄
λλ€.
μ€μΉ λ° dotnet μ€ν
WSL2 + Ubuntu-22.04 + .Net Runtime 7.0 + Oracle Client 19.3 μ€μΉ
$ dotnet /home/test/test.dll > /dev/null 2>&1 & μ€ν
νλ‘κ·Έλ¨ ν
μ€νΈ
oracle μ°κ²° λ° λ°μ΄ν° κ°μ Έμ€λ νλ‘κ·Έλ¨ μ μ λμ
ms-sql μ°κ²° λ° λ°μ΄ν° κ°μ Έμ€λ νλ‘κ·Έλ¨ μ€λ₯ λ°μ(μλμ° νκ²½[λμΌ PC]μμ μ€ννλ©΄ μ μ μ κ·Ό κ°λ₯)
Microsoft.Data.SqlClient.SqlException (0x80131904):
A connection was successfully established with the server,
but then an error occurred during the pre-login handshake.
(provider: SSL Provider, error: 31 - Encryption(sβ¦
μ λ§ν¬μ λ΄μ©μ μ°Έκ³ νλ©΄μ ν
μ€νΈλ₯Ό μ§νν΄λ΄€μ΅λλ€.
2λ²κ³Ό 3λ²μ κ²½μ°μλ λ΅λ³μ λ΄μ©λλ‘ openssl.cnf λ₯Ό μμ νλ
Connection O.K κ° λμλλ°,
1λ² Serverμ κ²½μ°μλ μ€λ₯ λ΄μ©μ΄
"
Error: Connection Timeout Expired. The timeout period elapsed during the post-login phase. The connection could have timed out while waiting for server to complete the login process and respond; Or it could have timed out while attempting to create multiple active connections. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=0; handshake=9; [Login] initialization=0; authentication=0; [Post-Login] complete=14005;
"
λ‘ λ°λμμΌλ μ€μ λ‘ μ°κ²°μ΄ λμ§λ μμ΅λλ€.
μ΄κ²μ κ² μ°Ύμλ³΄λ€ λ³΄λ,
Linux (ubuntu)μ κ²½μ° SSL μ TLS μ μ±
μ λ°λΌκ°λλ°
Microsoft.Data.SqlClientλ₯Ό Linux μμ μ¬μ©νλ €λ©΄
μ΅μ TLS v1.2 κ° νμνλ°
MS SQL Server 2005μ ν¨μΉκ° μ λ 2008μ κ²½μ°μλ
TLS v1.0 λ§ μ§μνλ―λ‘ μ¬μ©ν μ μλ€λΌκ³ νλ€μ.
μ΄ κ²½μ°μ, λ§μ½
MS SQL Server 2005 μ Microsoft.Data.SqlClient κ°μ
μ°κ²°μ΄ κ°λ₯ν λ€λ₯Έ λ°©λ²μ΄ μμκΉμ?
μλλ©΄ ꡬν μλ²λ
System.Data.SqlClient λ₯Ό μ΄μ©νλ λ°©λ²λ°μ μμκΉμ?
2κ°μ μ’μμ
rkttu
5μ 28, 2025, 11:06μ€μ
2
μ§λ¬Έ λ΅λ³μ μμ κ²μνμ΄ μλ μ μ ν μ§λ¬Έ λ΅λ³ κ²μνμ μ¬λ €μ£Όμλ©΄ κ°μ¬νκ² μ΅λλ€. μΉ΄ν
κ³ λ¦¬λ λ³κ²½ν΄λλ Έμ΅λλ€.
2κ°μ μ’μμ
κ²°λ‘ λΆν° μκΈ°νλ©΄ System.Data.SqlClientλ₯Ό μ¬μ©νλ λ°©λ²μ΄λ Encrypt=Optional;TrustServerCertificate=True λ₯Ό λ£μ΄μ μ¬μ©νλ λ°©λ² λ°μ μμ κ±° κ°μ΅λλ€. 보μμ μΌλ‘ 보면 μ’μ§ μμ μ νλ€μΈλ° 2019 μ λλ‘λ§ μ¬λ¦¬λ©΄ bestκΈ΄ ν ν
λ° μ¬κ±΄μ΄ μ΄λ μ μ§ λͺ°λΌ μ μ΄λ 2012 SP4 μ΄μμΌλ‘ μ¬λ¦¬μλ 건 μ΄λ¨μ§ μ견λλ €λ΄μ.
hsjeong
5μ 29, 2025, 3:07μ€μ
5
Encrypt=False;
Encrypt=False; TrustServerCertificate=True;
Encrypt=True; TrustServerCertificate=True;
Encrypt=Optional; TrustServerCertificate=True;
4κ°μ§λ₯Ό λͺ¨λ ν΄λ΄€λλ° Linux μμλ
Encrypt = True ; μΌ λμ Encrypt = Optional; μΌ λλ λ§μ°¬κ°μ§λ‘ μ μμ΄ μ λλ€μ.
νμΈν΄λ΄€μ λ μλ‘ λ°κ²¬ν μ μ,
AMD64 κΈ°λ° PCν Ubuntu 24.04 μμλ
MS SQL Server 2008 SP2 λ₯Ό Encrypt=Falseλ‘λ μ μμ΄ λλλ°
Arm64 (aarch64κΈ°λ°) Ubuntu 22.04 μμλ
κ°μ connection string μ κ°μ 쑰건μΌλ‘ λ§μΆ°λμλ
μ μμ΄ μ λκ³
Error: A connection was successfully establisehd with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error:35 - An internal exception was caught)
μ€λ₯κ° λ°μνλ€μ.
μΌλ¨μ μ νλ‘κ·Έλ¨μμλ ꡬ λ²μ μ§μμ μ νλκ±Έλ‘ κ³ λ €ν΄λ³΄μνκ² λ€μ.
κ°μ¬ν©λλ€.
1κ°μ μ’μμ