SignalR с клиентом Xamarin, получающим «CERTIFICATE_VERIFY_FAILED» при вызове метода StartAsyn c () - PullRequest
0 голосов
/ 22 марта 2020

Вызов SignalR StartAsyn c от моего клиента Xamarin выдает меня:

[ERROR] FATAL UNHANDLED EXCEPTION: System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> Mono.Btls.MonoBtlsException: Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED

Может кто-нибудь помочь мне с этим CERTIFICATE_VERIFY_FAILED ??

Вот трассировка стека:

[ОШИБКА] ИСКЛЮЧИТЕЛЬНО НЕРАЗРЕШЕННОЕ ИСКЛЮЧЕНИЕ: Система. Net .Http.HttpRequestException: Не удалось установить соединение SSL, см. Внутреннее исключение. ---> System.Security.Authentication.AuthenticationException: аутентификация не удалась, см. Внутреннее исключение. ---> Mono.Btls.MonoBtlsException: ошибка Ssl: 1000007d: процедуры SSL: OPENSSL_internal: CERTIFICATE_VERIFY_FAILED 03-21 23: 59: 57.526 E / mono-rt (6307): в / Users / builder / jenkins / workspace / archive- mono / 2019-08 / android / release / external / boringssl / ssl / handshake_client. c: 1132 03-21 23: 59: 57.526 E / mono-rt (6307): в Mono.Btls.MonoBtlsContext.ProcessHandshake () [0x00042] в /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/mcs/class/System/Mono.Btls/MonoBtlsContext.cs:220 03-21 23: 59: 57.526 E / mono-rt (6307): в Mono. Net .Security.MobileAuthenticatedStream.ProcessHandshake (Mono. Net .Security.AsyncOperationStatus статус, пересмотр System.Boolean) [0x000da] в / Users / builder / jenkins / workspace / archive -mono / 2019-08 / android / release / mcs / class / System / Mono. Net .Security / MobileAuthenticatedStream.cs: 840 03-21 23: 59: 57.526 E / mono-rt (6307): в (оболочка remoting-invoke-with-check) Mono. Net .Security.MobileAuthenticatedStream.ProcessHandshake (Mono. Net .Security.AsyncOp erationStatus, bool) 03-21 23: 59: 57.526 E / mono-rt (6307): в Mono. Net .Security.AsyncHandshakeRequest.Run (Mono. Net .Security.AsyncOperationStatus status) [0x00000] в / Пользователи / строитель / jenkins / workspace / archive-mono / 2019-08 / android / release / mcs / class / System / Mono. Net .Security / AsyncProtocolRequest.cs: 289 03-21 23: 59: 57.526 E / mono -rt (6307): в Mono. Net .Security.AsyncProtocolRequest.ProcessOperation (System.Threading.CancellationToken cancellationToken) [0x000fc] в / Users / builder / jenkins / workspace / archive-mono / 2019-08 / android / release /mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:223 03-21 23: 59: 57.526 E / mono-rt (6307): --- Конец трассировки стека внутренних исключений --- 03 -21 23: 59: 57.526 E / mono-rt (6307): в Mono. Net .Security.MobileAuthenticatedStream.ProcessAuthentication (System.Boolean runSynchronously, Mono. Net .Security.MonoSslAuthenticationOptions options, System.ThreadTokenCence cancellationToken) [0x0025c] в / Users / builder / jenkins / workspace / arch ive-mono / 2019-08 / android / release / mcs / class / System / Mono. Net .Security / MobileAuthenticatedStream.cs: 406 03-21 23: 59: 57.526 E / mono-rt (6307): в системе . Net .Http.ConnectHelper.EstablishSslConnectionAsyncCore (поток System.IO.Stream, System. Net .Security.SslClientAuthenticationOptions sslOptions, System.Threading.CancellationToken cancellationToken) -mono / 2019-08 / android / release / external / corefx / src / System. Net .http / src / System / Net / Http / SocketsHttpHandler / ConnectHelper.cs: 165 03-21 23: 59: 57.526 E / mono-rt (6307): --- Конец трассировки стека внутренних исключений --- 03-21 23: 59: 57.526 E / mono-rt (6307): в системе. Net .Http.ConnectHelper.EstablishSslConnectionAsyncCore (система Поток .IO.Stream, System. Net .Security.SslClientAuthenticationOptions sslOptions, System.Threading.CancellationToken cancellationToken) [0x000f6] в / Users / builder / jenkins / workspace / archive-mono / 2019-08 / android / release / external /corefx/src/System.Net.Http/src/Sys tem / Net / Http / SocketsHttpHandler / ConnectHelper.cs: 176 03-21 23: 59: 57,526 E / mono-rt (6307): в System.Threading.Tasks.ValueTask 1[TResult].get_Result () [0x0001b] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813 03-21 23:59:57.526 E/mono-rt ( 6307): at System.Net.Http.HttpConnectionPool.CreateConnectionAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x002d8] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:394 03-21 23:59:57.526 E/mono-rt ( 6307): at System.Threading.Tasks.ValueTask 1 [TResult] .get_Result () [ 0x0001b] в /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813 03-21 23: 59: 57.526 E / mono-rt (6307): в системе. Net. ValueTask`1 [TResult] creationTask) [0x000a2] в /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net.Http/src/System /Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:529

А вот подробности исключения:

Система. Net .Http.HttpRequestException Message = Соединение SSL не может быть установлено, см. внутреннее исключение. Source = mscorlib StackTrace: at System. Net .Http.ConnectHelper.EstablishSslConnectionAsyncCore (Поток System.IO.Stream, System. Net .Security.SslClientAuthenticationOptions sslOptions, System.Threading.Cancellation0en6006006) builder / jenkins / workspace / archive-mono / 2019-08 / android / release / external / corefx / src / System. Net .Http / src / System / Net / Http / SocketsHttpHandler / ConnectHelper.cs: 176 at Система. Threading.Tasks.ValueTask 1[TResult].get_Result () [0x0001b] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813 at System.Net.Http.HttpConnectionPool.CreateConnectionAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x002d8] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:394 at System.Threading.Tasks.ValueTask 1 [TResult] .get_Result () [0x0001b] в / Users / builder / jenkins / workspace / archive-mono / 2019-08 / android / release / external / corefx / src / Common / src /CoreLib/System/Threading/Tasks/ValueTask.cs:813 в System. Net .Http.HttpConnectionPool.WaitForCreatedConnectionAsyn c (System.Threading.Tasks.ValueTask 1[TResult] creationTask) [0x000a2] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:529 at System.Threading.Tasks.ValueTask 1 [TResult00b). ] в /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813 в System. Net .Http.HttpConnectionPool.SendW ithRetryAsyn c (System. Net .Http.HttpRequestMessage request, System.Boolean doRequestAuth, System.Threading.CancellationToken cancellationToken) [0x0003f] в / Users / builder / jenkins / workspace / archive-mono / 2019-08 и /release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:284 в System. Net .Http.RedirectHandler.SendAsyn c (система. Net .Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00070] в /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net .Http / src / System / Net / Http / SocketsHttpHandler / RedirectHandler.cs: 32 в Microsoft.AspNetCore.Http.Connections.Client.Internal.AccessTokenHttpMessageHandler.SendAsyn c (системный. * 1063Mhtp. , System.Threading.CancellationToken cancellationToken) [0x000ff] в <143c191c2fa54eed93ae7f23c7781c1f>: 0 в Microsoft.AspNetCore.Http.Connections.Client.Internal.LoggingHttpMe ssageHandler.SendAsyn c (System. Net .Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00095] в <143c191c2fa54eed93ae7f23c7781c1f>: 0 в системе. .Tasks.Task 1[TResult] sendTask, System.Net.Http.HttpRequestMessage request, System.Threading.CancellationTokenSource cts, System.Boolean disposeCts) [0x000b3] in /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpClient.cs:531 at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.NegotiateAsync (System.Uri url, System.Net.Http.HttpClient httpClient, Microsoft.Extensions.Logging.ILogger logger, System.Threading.CancellationToken cancellationToken) [0x00257] in <143c191c2fa54eed93ae7f23c7781c1f>:0 at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.GetNegotiationResponseAsync (System.Uri uri, System.Threading.CancellationToken cancellationToken) [0x00080] in <143c191c2fa54eed93ae7f23c7781c1f>:0 at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.SelectAndStartTransport (Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x00180] in <143c191c2fa54eed93ae7f23c7781c1f>:0 at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartAsyncCore (Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x0011e] in <143c191c2fa54eed93ae7f23c7781c1f>:0 at System.Threading.Tasks.ForceAsyncAwaiter.GetResult () [0x0000c] in <143c191c2fa54eed93ae7f23c7781c1f>:0 at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.StartAsync (Microsoft.AspNetCore.Connections.TransferFormat transferFormat, System.Threading.CancellationToken cancellationToken) [0x00091] in <143c191c2fa54eed93ae7f23c7781c1f>:0 at Microsoft.AspNetCore.Http.Connections.Client.HttpConnectionFactory.ConnectAsync (System.Net.EndPoint endPoint, System.Threading.CancellationToken cancellationToken) [0x00114] in <143c191c2fa54eed93ae7f23c7781c1f>:0 at Microsoft.AspNetCore.Http.Connections.Client.HttpConnectionFactory.ConnectAsync (System.Net.EndPoint endPoint, System.Threading.CancellationToken cancellationToken) [0x001bf] in <143c191c2fa54eed93ae7f23c7781c1f>:0 at System.Threading.Tasks.ValueTask 1 [TResult] .get_Result () [0x0001b] в / Users / builder / jenkins / workspace / archive-mono / 2019-08 / android / release / external / corefx / src / Common / src / CoreLib / System / Threading / Tasks / ValueTask.cs: 813 в Microsoft.AspNetCore.SignalR.Client.HubConnection.StartAsyncCore (System.Threading.CancellationToken cancellationToken) [0x000a5] в: 0 в Microsoft.AspNetCore.liignH.Cign.Conign.Cign.ConignCore.SignalC. StartAsyncInner (System.Threading.CancellationToken cancellationToken) [0x0019e] в: 0 в System.Threading.Tasks.ForceAsyncAwaiter.GetResult () [0x0000c] в: 0 в Microsoft.AspNetCore.SignalR.Client.Hubyn * * 67 .Threading.CancellationToken cancellationToken) [0x00091] в: 0 на MobileApp.Services.HubService.SendMessage (Mo сообщение bileApp.Models.Message) [0x00042] в C: \ Users \ sipfe \ source \ repos \ HostelProj v2 - RealTime \ MobileApp \ MobileApp \ Services \ HubService.cs: 38 в MobileApp.ViewModels.ConversationDetailViewModel.ExecuteSendommand ( [0x00155] в C: \ Users \ sipfe \ source \ repos \ HostelProj v2 - RealTime \ MobileApp \ MobileApp \ ViewModels \ ConversationDetailViewModel.cs: 83 в MobileApp.ViewModels.ConversationDetailViewModel. <. ctor> b__34_0 () [0x00028] в C: \ Users \ sipfe \ source \ repos \ HostelProj v2 - RealTime \ MobileApp \ MobileApp \ ViewModels \ ConversationDetailViewModel.cs: 55 в System.Runtime.CompilerServices.AsyncMethodBuderder * .b__7_0 (состояние System.Object) [0x00000] в / Users / builder / jenkins / workspace / archive-mono / 2019-08 / android / release / mcs / class / referenceource / mscorlib / system / runtime / compilerservices / AsyncMethodBuilder. cs: 1021 в Android .App.SyncContext + <> c__DisplayClass2_0.b__0 () [0x00000] в: 0 в Java .Lang.Thread + RunnableImplementor.Run () [0x00008] в: 0 в Java .Lang .IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] в: 0 at (оберточный динамический c -метод) Android .Runtime.DynamicMethodNameCounter.70 (intptr, intptr)

Спасибо, ребята

1 Ответ

0 голосов
/ 22 марта 2020

Узнайте, выполнив поиск по переполнению стека, вот ссылка для решения:

Игнорирование ошибок SSL с сигналом CoreR

только что добавлены опции в мой HubConnectionBuilder и это сработало !!

 HubConnection = new HubConnectionBuilder()
            .WithUrl($"https://10.0.2.2:5001/chatHub", (opts) =>
            {
                opts.HttpMessageHandlerFactory = (message) =>
                {
                    if (message is HttpClientHandler clientHandler)
                        // bypass SSL certificate
                        clientHandler.ServerCertificateCustomValidationCallback +=
                            (sender, certificate, chain, sslPolicyErrors) => { return true; };
                    return message;
                };
            })
            .Build();
...