Open Closed

Xamarin Signalr HubConnection #10580


0
Astech created

Prerequisites

  • What is your product version? 10.4.0
  • What is your product type (Angular or MVC)? MVC
  • What is product framework type (.net framework or .net core)? .Net Core

Hi,

I am having trouble getting the Xamarin Signalr hub connection working. Please find all the details below:

SplashActivity.cs StartApplication:

DebugServerIpAddresses.Current = "192.168.0.22";

App.xaml.cs OnStart:

HubConnection = new HubConnectionBuilder() .WithUrl("http://" + DebugServerIpAddresses.Current + ":44301/signalr-document-conversion", (opts) => { opts.HttpMessageHandlerFactory = (message) => { if (message is HttpClientHandler clientHandler) // bypass SSL certificate clientHandler.ServerCertificateCustomValidationCallback += (sender, certificate, chain, sslPolicyErrors) => { return true; }; return message; };

}).ConfigureLogging(logging => { logging.SetMinimumLevel(LogLevel.Debug); logging.AddConsole(); logging.AddDebug(); }).Build();

MVC Startup:

        app.UseEndpoints(endpoints =>
        {
            endpoints.MapHub<AbpCommonHub>("/signalr");
            endpoints.MapHub<ChatHub>("/signalr-chat");
            endpoints.MapHub<AgendaHub>("/signalr-agenda");
            endpoints.MapHub<MinuteHub>("/signalr-minute");
            endpoints.MapHub<DocumentHub>("/signalr-document-conversion");

            endpoints.MapControllerRoute("defaultWithArea", "{area}/{controller=Home}/{action=Index}/{id?}");
            endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");

            if (bool.Parse(_appConfiguration["HealthChecks:HealthChecksEnabled"]))
            {
                endpoints.MapHealthChecks("/health", new HealthCheckOptions()
                {
                    Predicate = _ => true,
                    ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
                });
            }
			
			app.ApplicationServices.GetRequiredService<IAbpAspNetCoreConfiguration>().EndpointConfiguration.ConfigureAllEndpoints(endpoints);
        });

Exception:

09-14 15:12:00.069 I/mono-stdout( 3758): dbug: Microsoft.AspNetCore.SignalR.Client.HubConnection[40] 09-14 15:12:00.069 I/mono-stdout( 3758): Registering handler for client method 'DocumentReordered'. 09-14 15:12:00.072 I/mono-stdout( 3758): dbug: Microsoft.AspNetCore.SignalR.Client.HubConnection[40] 09-14 15:12:00.072 I/mono-stdout( 3758): Registering handler for client method 'DocumentStatusChanged'. 09-14 15:12:00.076 I/mono-stdout( 3758): dbug: Microsoft.AspNetCore.SignalR.Client.HubConnection[41] 09-14 15:12:00.076 I/mono-stdout( 3758): Starting HubConnection. 09-14 15:12:00.081 I/mono-stdout( 3758): dbug: Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[1] 09-14 15:12:00.081 I/mono-stdout( 3758): Starting HttpConnection. 09-14 15:12:00.084 I/mono-stdout( 3758): dbug: Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[8] 09-14 15:12:00.084 I/mono-stdout( 3758): Establishing connection with server at 'http://192.168.0.22:44301/signalr-document-conversion'. 09-14 15:12:00.094 V/ViewRootImpl( 3758): The specified message queue synchronization barrier token has not been posted or has already been removed 09-14 15:12:00.108 D/DecorView( 3758): onWindowFocusChangedFromViewRoot hasFocus: true, DecorView@7c425ad[MainActivity] 09-14 15:12:00.123 D/OnePlusJankManager( 3758): Chor uploadMDM JANK_TYPE_ONCE mViewTitle = com.Congresso.Mobile/crc64fd27f5768c743714.MainActivity--- jank level = 2 09-14 15:12:00.129 I/mono-stdout( 3758): fail: Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[10] 09-14 15:12:00.129 I/mono-stdout( 3758): Failed to start connection. Error getting negotiation response from 'http://192.168.0.22:44301/signalr-document-conversion'. 09-14 15:12:00.129 I/mono-stdout( 3758): System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.IO.IOException: The server returned an invalid or unrecognized response. 09-14 15:12:00.129 I/mono-stdout( 3758): at System.Net.Http.HttpConnection.FillAsync () [0x0016e] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs:1360 09-14 15:12:00.129 I/mono-stdout( 3758): at System.Net.Http.HttpConnection.ReadNextResponseHeaderLineAsync (System.Boolean foldedHeadersAllowed) [0x00259] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs:1307 09-14 15:12:00.129 I/mono-stdout( 3758): at System.Threading.Tasks.ValueTask1[TResult].get_Result () [0x0001b] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/Common/src/CoreLib/System/Threading/Tasks/ValueTask.cs:813 09-14 15:12:00.130 I/mono-stdout( 3758): at System.Net.Http.HttpConnection.SendAsyncCore (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00d54] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs:568 09-14 15:12:00.130 I/mono-stdout( 3758): --- End of inner exception stack trace --- 09-14 15:12:00.130 I/mono-stdout( 3758): at System.Net.Http.HttpConnection.SendAsyncCore (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x012d9] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs:743 09-14 15:12:00.130 I/mono-stdout( 3758): at System.Net.Http.HttpConnectionPool.SendWithNtConnectionAuthAsync (System.Net.Http.HttpConnection connection, System.Net.Http.HttpRequestMessage request, System.Boolean doRequestAuth, System.Threading.CancellationToken cancellationToken) [0x000e6] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:330 09-14 15:12:00.130 I/mono-stdout( 3758): at System.Net.Http.HttpConnectionPool.SendWithRetryAsync (System.Net.Http.HttpRequestMessage request, System.Boolean doRequestAuth, System.Threading.CancellationToken cancellationToken) [0x00101] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:296 09-14 15:12:00.130 I/mono-stdout( 3758): at System.Net.Http.RedirectHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00070] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/RedirectHandler.cs:32 09-14 15:12:00.130 I/mono-stdout( 3758): at Microsoft.AspNetCore.Http.Connections.Client.Internal.AccessTokenHttpMessageHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x000ff] in <559e9e9efbf743acb6b2cd8b35a77f26>:0 09-14 15:12:00.130 I/mono-stdout( 3758): at Microsoft.AspNetCore.Http.Connections.Client.Internal.LoggingHttpMessageHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00095] in <559e9e9efbf743acb6b2cd8b35a77f26>:0 09-14 15:12:00.130 I/mono-stdout( 3758): at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered (System.Threading.Tasks.Task1[TResult] sendTask, System.Net.Http.HttpRequestMessage request, System.Threading.CancellationTokenSource cts, System.Boolean disposeCts) [0x000b3] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpClient.cs:531 09-14 15:12:00.130 I/mono-stdout( 3758): 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) [0x0014a] in <559e9e9efbf743acb6b2cd8b35a77f26>:0 09-14 15:12:00.142 I/mono-stdout( 3758): dbug: Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[5] 09-14 15:12:00.142 I/mono-stdout( 3758): Skipping dispose, connection is already disposed. 09-14 15:12:00.162 I/mono-stdout( 3758): dbug: Microsoft.AspNetCore.Http.Connections.Client.HttpConnection[5] 09-14 15:12:00.162 I/mono-stdout( 3758): Skipping dispose, connection is already disposed.


1 Answer(s)
  • 0
    ismcagdas created
    Support Team

    Hi @Astech

    We have replied to your email, please let us know if you are still having problems.