Sharing a SignalR hub between a WebApi and MVC project

后端 未结 1 769
逝去的感伤
逝去的感伤 2020-12-30 04:31

Is there a recommended approach to sharing a SignalR hub across two applications?

The actual situation is a public facing WebAPI project and an internal MVC WebApp.

1条回答
  •  误落风尘
    2020-12-30 05:24

    Just setup signalr message routing through a SQL Server table. It will automatically connect all hubs using the same routing setup. Nothing else to do, it's magic.

    GlobalHost.DependencyResolver.UseSqlServer(ConfigurationManager.ConnectionStrings["signalr"].ConnectionString);
    

    You will need the following nuget package: Microsoft.AspNet.SignalR.SqlServer

    0 讨论(0)
提交回复
热议问题