You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

.NET 8连接SQL Server 11.0.5058时TLS预登录握手失败求助

.NET 8项目连接SQL Server 11.0.5058时TLS握手失败求助

我们基于.NET 8构建的项目,在连接版本为11.0.5058的SQL Server时遇到TLS握手失败问题,具体信息如下:

项目Docker配置

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime

WORKDIR /app
EXPOSE 80

ENV ASPNETCORE_URLS=http://+:80
Copy . .

RUN sed -i 's/MinProtocol = TLSv1.2/MinProtocol = TLSv1/g' /etc/ssl/openssl.cnf
RUN sed -i 's/MinProtocol = TLSv1.2/MinProtocol = TLSv1/g' /usr/lib/ssl/openssl.cnf

RUN cat /etc/ssl/openssl.cnf

ENTRYPOINT ["dotnet", "Api.dll"]

连接错误信息

System.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(ssl/tls) handshake failed)

数据库连接字符串

server=(myserver);Database=MyDB;uid=MYUSER;pwd=PASS;TrustServerCertificate=true

我们已尝试过SqlClient相关公开讨论中针对该问题的所有解决方案,但均未解决问题,恳请大家提供排查建议。

内容的提问来源于stack exchange,提问作者Mehran Hafizi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.04 02:22:46