简体   繁体   中英

.NET 6 Connection to SQL Server 2008

I have 2 applications that connect to legacy SQL Server 2008 servers. These apps are currently running on .NET 3.1 and working fine.

I want to upgrade them to .NET 6, but in doing so, the app fails to connect to the database. I know this is due to this change in .NET 5:

TLS Cipher Suits

When it tries to connect, I get an error:

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)

All of the pages I have found on how to fix this require changing the openssl.cnf file, but unfortunately this is not an option for me. These applications are running on containers in Pivotal Cloud Foundry (or I guess it's called VMware Tanzu now) that I have no control over, and our platform team is unable to modify the openssl.cnf file prior to deployment. The containers run Ubuntu version 18.04. Pretty much the only things I have control over are:

  • The application itself, which is deployed into a folder and run as a non-admin account
  • Files installed with the app... I can deploy whatever files I want with the application, but they are all installed under the app folder
  • The command(s) run to start the application
  • Environment variables (I can set any I need when my app is deployed)

I also have no control over the database - it is SQL Server 2008 with no option to upgrade.

I have tried changing connection string options like TrustServerCertificate and Encrypt , but nothing works there. And I've tried that using both newer and older versions of both Microsoft.Data.SqlClient and System.Data.SqlClient . All failed.

We had a similar issue with an external API we hit, and were able to create a custom HttpMessageHandler that allowed more ciphers, but I see no option for that with a SqlConnection .

Does anyone know how I can upgrade to .NET 6 and still connect to this database without modifying the openssl.cnf file that comes with the OS?

Patch the server to support TLS 1.2. KB3135244 - TLS 1.2 support for Microsoft SQL Server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM