How to fix the connection problem from .NetMaui to SQLServer with Microsoft.Data.SqlClient

İsmail Ekşi 0 Reputation points
2023-11-27T08:58:57.1366667+00:00

please hekp me to solve problem below..

There is a small .netMaui software connect to SqlServer. Once I run "Windows Machine", everything is fine.

Once I turn it to Android emulatr, I get error message belowe.

How can I solve it?

{Microsoft.Data.SqlClient.SqlException (0x80131904): 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)

 ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception.

 ---> Interop+AndroidCrypto+SslException: Exception of type 'Interop+AndroidCrypto+SslException' was thrown.

Developer technologies .NET .NET MAUI
SQL Server Other
{count} votes

1 answer

Sort by: Most helpful
  1. Olaf Helper 47,436 Reputation points
    2023-11-27T10:37:04.45+00:00

    Authentication failed,

    Are you using Windows Authentication in your connection string? That works on Windows but not on Android.

    Change to SQL Authentiction instead.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.