.NET Core 3.1 jenkins 部署后程式报错。Connection Timeout Expired. The timeout period elapsed during the post-login phase.
dotnet core 3.1的程式在IIS运行的好好的,把它弄到jenkins部署,程式连接的数据库有Oracle、postgresql、sqlserver。
下面问题出现报错原因是SQL Server版本(2008 R2 (RTM))太低原因。
首先测试报了以下错误:
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)
查看 openssl.cnf 配置文件:
cat /etc/ssl/openssl.cnf
SQL Server 数据库版本比较低不支持 TLSv1.2 ,修改为 TLSv1.0
在Dockerfile添加
RUN sed -i 's/TLSv1.2/TLSv1.0/g' /etc/ssl/openssl.cnf
然后再测试结果报以下错误:
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=2; handshake=377; [Login] initialization=4; authentication=10; [Post-Login] complete=29014;
查了相关资料发现:SqlClient能支持最小版本为 SQL Server 2008 R2 SP3,这个只能升级DB。
参考:

浙公网安备 33010602011771号