如何在 webfarm 中使用 SignalR,使用 Sql server 作为背板 [英] How to use SignalR in a webfarm, using Sql server as the backplane

查看:27
本文介绍了如何在 webfarm 中使用 SignalR,使用 Sql server 作为背板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基于此主题 signalr-sqlserver-listening,SignalR 可以在 webfarm 中使用,使用Sql server 作为背板向所有网络节点传递消息.

Based on this topic signalr-sqlserver-listening, SignalR can be used in a webfarm, using Sql server as the backplane to communicate messages to all webnodes.

我想知道是否有关于此的任何文档/示例.

I wonder if there is any documentation/example on this.

推荐答案

有一个未发布的 SignalR 实现,它使用 SQL Server 作为消息总线(背板),正在开发中.您可以从 https://github.com/SignalR/查看和编译源代码SignalR/tree/master/src/Microsoft.AspNet.SignalR.SqlServer

There is an unreleased implementation of SignalR using SQL Server as Message Bus (backplane) that is in the works. You can view and compile the source from https://github.com/SignalR/SignalR/tree/master/src/Microsoft.AspNet.SignalR.SqlServer

拥有编译版本并引用项目中的 SignalR.SqlServer 程序集后,您可以通过调用以下代码来启用 SQL Server 背板,通常是从全局中的 Application_Start 方法.asax.cs 文件.

Once you have a compiled version and make reference to the SignalR.SqlServer assembly in your project, you can enable the SQL Server backplane by invoking the following, typically from the Application_Start method in your global.asax.cs file.

 var connection = ConfigurationManager.ConnectionStrings["SignalRMessageBus"].ConnectionString;
 GlobalHost.DependencyResolver.UseSqlServer(connection);

这假设您已经在 web.config 文件中定义了 SignalRMessageBus 连接字符串.SignalR.SqlServer 程序集将创建所需的表,如果它们不存在于您使用连接字符串定位的数据库实例中,因此请确保您正在访问的帐户具有创建表的权限.

This assumes you have defined the SignalRMessageBus connection string in your web.config file. The SignalR.SqlServer assembly will create the needed tables if they do not already exist in the database instance you are targeting with your connection string, so make sure the account you are accessing with has the permissions to create tables.

同样,这还没有正式发布,但根据这个问题 - Sql server 向外扩展消息总线 这将是即将发布的 1.0 Alpha 1 版本的一部分.

Again, this has not been officially released but according to the issue for this - Sql server scale out Message Bus this will be part of the upcoming 1.0 Alpha 1 release.

这篇关于如何在 webfarm 中使用 SignalR,使用 Sql server 作为背板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆