当前位置:   article > 正文

A connection was successfully established with the server, but then an error occurred during the pre

a connection was successfully established with the server, but then an error

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)

 

出现问题的 asp.net core 程序是跑在容器中的,容器镜像用的是 mcr.microsoft.com/dotnet/core/aspnet:3.0

运行容器内的 openssl 命令发现 openssl 的版本比较高

1.进入容器

docker exec -it [容器ID] bash
openssl version

OpenSSL 1.1.1d  10 Sep 2019

查看 openssl.cnf 配置文件

cat /etc/ssl/openssl.cnf

[system_default_sect] MinProtocol = TLSv1.1 CipherString = DEFAULT@SECLEVEL=2

 发现允许的 ssl 最低版本是 TLSv1.2 ,而程序所使用的 SQL Server 数据库版本比较低不支持 TLSv1.2 ,修改为 TLSv1.0 后问题解决

4.修改方法:在 Dockerfile 中添加下面的指令

RUN sed -i 's/TLSv1.2/TLSv1.0/g' /etc/ssl/openssl.cnf
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/601798
推荐阅读
相关标签
  

闽ICP备14008679号