SignalR客户端在释放模式(UWP)中未接收信号

问题描述 投票:0回答:1

我在UWP应用程序中使用Microsoft.AspNetCore.SignalR.Client 3.1.1。我的代码在调试模式下可以正常工作,我的应用程序可以接收信号,但是当我使用发布模式时,我的应用程序不会接收信号。我认为VS的编译器不包含某些方法或类或其他内容。我该如何解决?我的代码如下:

var hubConnectionToWebService = new HubConnectionBuilder().WithUrl($"{Setting.Instance.UrlSignalR_WebService}").WithAutomaticReconnect(new RandomRetryPolicy()).Build();

hubConnectionToWebService.On<int, string>("ReceiveMessage", async (categoryID, tags) =>
                    {
                        Setting.Instance.CurrentCategoryID = categoryID;
                        await ReplacementBanners();
                    });

await ConnectWithRetryAsync(hubConnectionToWebService, tokenClosingClient);
c# uwp signalr signalr.client
1个回答
0
投票

我这样解决:在Default.rd.xml中的指令中添加了名称空间

<Namespace Name="System.Text.Json" Dynamic="Required All" />
© www.soinside.com 2019 - 2024. All rights reserved.