connection to sql server 2008 connection terminated?

打玻璃 1,526 Reputation points
2023-01-23T13:01:27.12+00:00

I connect to sql server 2008 the connection was terminated.

Sql Exception

A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 2 - Connection was terminated: Connection was terminated)

the code is:

var user = await _context.Users.AsNoTracking().FirstOrDefaultAsync(x => x.UserName == UserName);

is it the tls version not match? how to check database's tls version?

I do not know why I can not connect

my connectionstring has TrustedServerCertificate=true;

if not the error was :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

i am using .net 7.0;

and in macos.11.6.5

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
2,565 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
8,541 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Olaf Helper 25,726 Reputation points
    2023-01-24T06:39:06.45+00:00

    the code is:

    ... useless, because it don't give any usefull information.

    How does the connection string look like? Can you connect to SQL Server using tools like SSMS, SqlCmd, etc?

    Note: SQL Server version 2008 ist out-of-support since a very long time.