Xamarin - SignalR Hanging on connect

岁酱吖の 提交于 2021-02-10 20:29:13

问题


I'm trying to connect my Xamarin app to my SignalR backend which is hosted on Azure. The issue I'm having is every time I call StartAsync() on my HubConnection it just hangs the client and the request is never completed.

I have tried break pointing through the app to make sure this is actually where the hang is happening. I have tried using the exact same code on an ASP.Net Core project to confirm the SignalR connection is working, which it is, I can connect and send commands successfully. I have tried on IOS and Android both simulators and real devices and the same issue each time. Every time I hit the StartAsync the app just hangs. Each project has the latest Xamarin and Microsoft.AspNetCore.SignalR.Client Nuget installed.

HubConnection connection = new HubConnectionBuilder()
                .WithUrl("URLFORCHAT")
                .Build();

await connection.StartAsync();

The expected result is for the client to just connect and continue through the program just like the ASP.Net Core project does. I have seen other tutorials that have the same code as me and it is in fact working.

来源:https://stackoverflow.com/questions/54262710/xamarin-signalr-hanging-on-connect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!