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 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
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值