system.aggregateexception:xamarin上发生一个或多个错误

tez616oj  于 2021-06-20  发布在  Mysql
关注(0)|答案(0)|浏览(381)

帮帮你们,
我对使用xamarin android很陌生。我正在尝试将mysql数据库连接到我的应用程序。它停在 the con.Open(); 我真的不知道怎么了。

string myConnectionString = "Server=db4free.net;Port=3306;Database=*******;Uid=*******;Pwd=*******";
MySqlConnection con = new MySqlConnection(myConnectionString);
if (con.State == ConnectionState.Closed)
{
   con.Open(); //error here
}

我已经添加了库

using System.Data;
using MySql.Data.MySqlClient;

我还进口了 MySQLConnector 金块 Package 。我仍然在连接部分,因为我还没有做什么。
请注意,凭据是正确的,因为我能够使用php页面连接db。有什么想法吗?
编辑
在我的catch()上有这个错误

System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> Mono.Btls.MonoBtlsException: Ssl error:100000f0:SSL routines:OPENSSL_internal:UNSUPPORTED_PROTOCOL
  at /Users/builder/jenkins/workspace/xamarin-android-d15-7/xamarin-android/external/mono/external/boringssl/ssl/handshake_client.c:808
  at Mono.Btls.MonoBtlsContext.ProcessHandshake () [0x00038] in <5a97d41d36694fb19855c17429527b10>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncOperationStatus status) [0x0003e] in <5a97d41d36694fb19855c17429527b10>:0 
  at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake(Mono.Net.Security.AsyncOperationStatus)
  at Mono.Net.Security.AsyncHandshakeRequest.Run (Mono.Net.Security.AsyncOperationStatus status) [0x00006] in <5a97d41d36694fb19855c17429527b10>:0 
  at Mono.Net.Security.AsyncProtocolRequest+<ProcessOperation>d__24.MoveNext () [0x000ff] in <5a97d41d36694fb19855c17429527b10>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at Mono.Net.Security.AsyncProtocolRequest+<StartOperation>d__23.MoveNext () [0x0008b] in <5a97d41d36694fb19855c17429527b10>:0 
   --- End of inner exception stack trace ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at Mono.Net.Security.MobileAuthenticatedStream+<ProcessAuthentication>d__47.MoveNext () [0x00254] in <5a97d41d36694fb19855c17429527b10>:0 }
    base: {System.SystemException}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题