connection to sql server 2008 connection terminated?

mc 3,601 Reputation points

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

A set of technologies in the .NET Framework for building web applications and XML web services.
4,115 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.
12,573 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Olaf Helper 40,576 Reputation points

    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.