Android .NET6 Microsoft.Data.SQLClient, error during the connection to SQL Server 2019

Keven Thériault 1 Reputation point
2022-11-10T20:15:30.593+00:00

I use the new stack of development Android C# (not Xamarin). I have SQL Server 2019 and Visual Studio 2022.

During the connection to the server with ADO.NET (Microsoft.Data.SQLClient) I have this error :

A connection was succesfully established with the server, but then an orror occured during the pre-login handshake TCP provider error 35

I also had this error with the stack Console .NET 6, but I solve that with add of Trust Server Certificate=true in the connection string. This solution don't resolve my problem with the Android stack. I think the problème is when client and server are on different device...

I need solution for my students !!!

Thanks !!!

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,483 questions
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,747 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 53,426 Reputation points
    2022-11-24T18:45:25.893+00:00

    On mobile apps, code can not override certificate trust. You can:

    1. Buy a trusted certificate for the Sqlserver
    2. On each mobile device install as trusted. See andriod docs for this
    3. Disable encryption on the Sqlserver.
    0 comments No comments