Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sql connection error #2174

Closed
Vazeem-T opened this issue Oct 3, 2023 · 2 comments
Closed

Sql connection error #2174

Vazeem-T opened this issue Oct 3, 2023 · 2 comments
Labels
2️⃣ Duplicate Issue/PR that is a duplicate and already exists.

Comments

@Vazeem-T
Copy link

Vazeem-T commented Oct 3, 2023

Previously i had connected in xamarin the same way ,But now when i started using MAUI i am not able to connect sql server the same way , I am trying to make a local connection to sql server without using any api's .

` private async void ImportButton_Clicked(object sender, EventArgs e)
{
try
{
using(SqlConnection con = new SqlConnection("Data Source=10.10.1.209; Initial Catalog = PARSAccTrPluscrk;User ID = vaseem1; Password=vaseem;TrustServerCertificate=True;"))
{
con.Open();
if (con.State == System.Data.ConnectionState.Open)
{
await DisplayAlert("Success", "Your Connection is Successfull", "OK");
}
else
{
await DisplayAlert("Alert", "Check Your Connection!", "OK");

            }
        }
    }
    catch (Exception ex)
    {
        await DisplayAlert("Alert", ex.Message, "OK");
    }

}`

{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.
--- End of inner exception stack trace ---
at System.Net.Security.SslStream.d__1461[[System.Net.Security.SyncReadWriteAdapter, System.Net.Security, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext() at System.Net.Security.SslStream.AuthenticateAsClient(SslClientAuthenticationOptions sslClientAuthenticationOptions) at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation) at Microsoft.Data.SqlClient.SNI.SNITCPHandle.EnableSsl(UInt32 options) in D:\a\_work\1\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\SNI\SNITcpHandle.cs:line 615 at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) in D:\a_work\1\s\src\Microsoft.Data.SqlClient\src\Microsoft\Data\SqlClient\SqlInternalConnection.cs:line 776
at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) in D:\a_work\1\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\TdsParser.cs:line 1404
at Microsoft.Data.SqlClient.TdsParser.EnableSsl(UInt32 info, SqlConnectionEncryptOption encrypt, Boolean integratedSecurity, String serverCertificateFilename) in D:\a_work\1\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\TdsParser.cs:line 894
at Microsoft.Data.SqlClient.TdsParser.ConsumePreLoginHandshake(SqlConnectionEncryptOption encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean& marsCapable, Boolean& fedAuthRequired, Boolean tlsFirst, String serverCert) in D:\a_work\1\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\TdsParser.cs:line 1059
at Microsoft.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnectionString connectionOptions, Boolean withFailover) in D:\a_work\1\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\TdsParser.cs:line 528

@JRahnama JRahnama added the 🆕 Triage Needed For new issues, not triaged yet. label Oct 3, 2023
@JRahnama JRahnama added 2️⃣ Duplicate Issue/PR that is a duplicate and already exists. and removed 🆕 Triage Needed For new issues, not triaged yet. labels Oct 4, 2023
@JRahnama
Copy link
Contributor

JRahnama commented Oct 4, 2023

@Vazeem-T seems like a duplicate of #2050, #1656 and #1412

@DavoudEshtehari
Copy link
Contributor

Closing it as it's a duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2️⃣ Duplicate Issue/PR that is a duplicate and already exists.
Projects
Development

No branches or pull requests

3 participants