更新到 dotNet6 后 SignalR 未连接

SignalR not connecting after updating to dotNet6

我将服务器更新到 .NET 6 并保持旧程序和启动 类 不变,一切正常,但 SignalR。 更新后,xamarin客户端拒绝连接hub,一直处于连接状态

我必须在服务器端对 signalR 进行任何更改还是其他地方有问题?

Namespace Hubs
{
    public class NotifyHub: Hub
    {

        public override async Task OnConnectedAsync()
        {
            await base.OnConnectedAsync();
        }
    }

xamarin 客户端:

namespace Clients
{
    class NotifyHubClient : INotifyHubClient
    {
        IDocumentService _ds;
        private HubConnection hubConnection;

        public async Task Connect()
        {
            if (hubConnection == null || hubConnection.State 
                == HubConnectionState.Disconnected)
            {
                InitConnection();
                await hubConnection.StartAsync();
            }
        }

        private void InitConnection()
        {
            _ds = ContainerLocator.Container.Resolve<IDocumentService>();
            hubConnection = new HubConnectionBuilder()
              .WithUrl("https://10.0.0.189:9001/hobosoft/notifier", options => {
                  options.HttpMessageHandlerFactory = (message) =>
                  {
                       if (message is HttpClientHandler clientHandler)
                           clientHandler.ServerCertificateCustomValidationCallback
                            +=(sender, certificate, chain, sslPolicyErrors) 
                            => { return true; };
                       return message;
                  };
              })
             .WithAutomaticReconnect()
             .Build();
        }

所以我找到了问题所在。 VS2022 与 xamarin SignalR 有问题,回到 VS2019 解决了这个问题。

这意味着我无法将服务器更新到 .NET 6,但是...