You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular中SignalR从3.1.5升级到6.0.11后result组件导航异常

Angular升级SignalR后导航异常问题

我的Angular项目集成了Microsoft SignalR服务,使用3.1.5版本时运行正常。升级至6.0.11版本后出现异常:用户扫描二维码后浏览器URL已变更,但无法导航至result组件,路由配置已确认无误。

相关代码

SignalR服务导航处理代码

this._hubConnection.on('PaymentCompleted', (statusData) => {
   if (statusData && statusData.skipInfoMessage) {
     window.location.href = statusData.redirectUrl;
   }else {
     if (statusData && statusData.success) {
        this.router.navigate(['result'], { queryParams: { status: true } });
     }else {
        this.router.navigate(['result'], { queryParams: { status: false } });
     }
   }
   this._hubConnection.stop().finally();
   this._hubConnection = null;
});

路由配置(app-routing.module.ts)

{
   path: 'result',
   component: ResultComponent
}

升级后启动错误及已做修复

升级SignalR后执行npm start时遇到两个错误:

  • SignalR服务中finally()方法相关问题
  • Node相关类型问题(具体错误信息已遗忘)

已采取的修复措施:

  • 在tsconfig.json的lib数组中添加es2018.promise
  • 在tsconfig.app.json的compilerOptions.types数组中添加node

项目后端基于.NET 6构建,除上述修改外未做其他变更,恳请提供导航异常的排查思路或解决方案。

内容的提问来源于stack exchange,提问作者dudu1234

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.08 22:33:13