linux - 由于 SSL/TLS 无法连接到 SQL Server
问题描述
自从将我的 Linux 服务器设置为托管 dotnet 应用程序以来,我一直收到此错误,它尝试连接到在 Windows 环境(2012 版)上运行的数据库引擎 SQL Server。linux服务器正在运行.Net 5,我试图在/usr/local/share/ca-certificates
文件夹下有一个证书,到目前为止没有运气。我还将 nginx 配置为使用 ssl:
server {
listen 80;
listen 443 ssl;
server_name 111.111.111.111;
ssl on;
ssl_certificate /usr/local/share/ca-certificates/cert.crt;
ssl_certificate_key /usr/local/share/ca-certificates/cert.key;
location /core/ {
proxy_pass https://127.0.0.1:7001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
//错误
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=111.111.111.111\\TESTDB4;Initial Catalog=Core;User ID=demo;Password=password;Integrated Security=False;TrustServerCertificate=False;Trusted_Connection=True;Encrypt=True;"
解决方案
您需要在 Web 服务器上使用证书。我不确切知道在哪里添加它,但我想它应该包含在您的数据库连接字符串中
推荐阅读
- android - 运动编辑器在 Android Studio 4.0 中不起作用
- javascript - JqueryDatatable ajax 将数据 null 发送到项目 .net core 2.0 上的操作
- python - 如何在包含列表作为值的列表中找到最大值?
- c - 在C中将二维数组转换为灰度图像
- arrays - 当我在 forEach 循环中重新分配属性时,为什么我的对象没有改变?
- c# - 使用“AS QUERY”防止 SQL 注入
- python-3.x - 如何在 Python 中更新变量之前存储它的值
- c# - 在 c# mongodb 驱动程序中创建一个唯一元素数组
- powershell - Get-WebConfiguration 不返回任何结果
- c# - 模型不会从动态添加的内容中将值返回给控制器?