c# - SignalR 客户端在释放模式 (UWP) 下不接收信号
问题描述
我在我的 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);
解决方案
我这样解决:将命名空间添加到 Default.rd.xml 中的指令
<Namespace Name="System.Text.Json" Dynamic="Required All" />
推荐阅读
- angular6 - DropBox Saver:按钮未显示。(角度 6)
- angular - 如何从Angular 6中的父组件调用子组件的方法
- r - 为特定值添加面板数据序列
- google-cloud-platform - 如何通过服务帐户使用 gcloud?
- wordpress - Wordress 前端帖子类别数组
- sha1 - 我正在使用 C# 编写 3DES(使用 SHA1 HASH)加密算法。密钥大小错误
- node.js - 使用 node.js 调用 Wikipedia Api 时出现问题
- c++ - 为什么我的删除节点功能实际上并未删除节点?
- c# - 以编程方式创建数据透视表
- javascript - 将 C# 变量传递给 HTML 按钮