提问人:Роман Кириллов 提问时间:8/24/2022 最后编辑:MassifoxРоман Кириллов 更新时间:9/9/2022 访问量:1603
ASP.NET 核心。System.Data.SqlClient.SqlException - SSL_ERROR_SSL
ASP.NET Core. System.Data.SqlClient.SqlException - SSL_ERROR_SSL
问:
我的规格:装有 MS SQL Server 2008 (SP4) 的 PC - 10.0.6535.0;Linux (Debian GNU/Linux) 上的 PC 和我的 ASP.NET Core 5.0 应用程序(用于 sql - System.Data.SqlClient)。 我无法向远程 SQL 服务器发出成功的 sql 请求。
记录:
[2022-08-24 13:41:55.3955] [ERROR] [GPNA.MyApplication.Infrastructure.Modules.DataLoaderModule] System.AggregateException: One or more errors occurred. (A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 35 - An internal exception was caught))
---> System.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 35 - An internal exception was caught)
---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception.
---> Interop+OpenSsl+SslException: SSL Handshake failed with OpenSSL error - SSL_ERROR_SSL.
---> Interop+Crypto+OpenSslCryptographicException: error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol
--- End of inner exception stack trace ---
SSL有什么问题?– 我在 Visual Studio 中关闭了 SSL。并尝试了 SqlConnectionString 中的不同变体,使用 linux config openssl.cnf 播放。问题是由我的应用程序、Linux 还是 SQL Server 引起的?
SqlConnectionString 如下所示:
Data Source=10.20.17.76;Initial Catalog=Runtime; User ID=sa; Password=******; Connect Timeout=300; TrustServerCertificate=True; Encrypt = False
谢谢!
更新: 我尝试在远程 PC Windows Server 2008 上启动我的应用程序,该应用程序使用 MS SQL Server 连接到 PC,它可以正常工作!在 Linux 上 - 不要。因此,问题不在MS SQL Server中。
答:
2赞
Роман Кириллов
9/5/2022
#1
我的错误:我应该写“TLSv1”,但我写了“TLSv1.0”,基于 Debian 的发行版。
openssl.cnf
[system_default_sect]
MinProtocol = TLSv1
CipherString = DEFAULT@SECLEVEL=1
评论
Encrypt=False
openssl.cnf
ssl_choose_client_version:unsupported protocol