【发布时间】:2016-11-16 10:09:39
【问题描述】:
我正在使用 signalR 构建一个实时网站。 我有 2 个集线器:
- NotificationHubCore
- NotificationHub(继承 NotificationHubCore)
我的解决方案包括 2 个小项目:Domain 和 Web。 我将 NotificationHubCore 放入 Domain,NotificationHub 放入 Web。
现在,在网页部分,我想通过以下方式访问 NotificationHubCore:
GlobalHost.ConnectionManager.GetHubContext<NotificationHubCore>();
它总是返回 null 给我。
我的问题是:如何通过 NotificationHub 访问 NotificationHubCore。
我试过了:
var notificationHub = new NotificationHub();
GlobalHost.DependencyResolver.Register(typeof(NotificationHubCore), () => notificationHub);
但这种方法行不通。
谁能帮帮我?
谢谢,
【问题讨论】:
标签: signalr signalr-hub signalr-2