Signalr 使用 Redis 背板不传播消息 [英] Signalr using Redis backplane not propagating message

查看:109
本文介绍了Signalr 使用 Redis 背板不传播消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 .net 4.5 MVC 应用程序,我最近将它转移到了 AWS,因此我们需要向我们的 Signalr 实现添加一个背板.我已按照 https://docs.microsoft.com/en-us/aspnet/signalr/overview/performance/scaleout-with-redis.我已经安装了 nuget 包,我当前的配置如下所示:

I have a .net 4.5 MVC app which I have recently moved over to AWS, so we need to add a backplane to our Signalr implementation. I have followed the steps outlined at https://docs.microsoft.com/en-us/aspnet/signalr/overview/performance/scaleout-with-redis. I have installed the nuget package and my current configuration looks like this:

[assembly: OwinStartup(typeof(SignalrBootstrapper))]
namespace app
{
    public class SignalrBootstrapper
    {
        public void Configuration(IAppBuilder app)
        {
            var scaleoutConfig = new RedisScaleoutConfiguration(ConnectionStrings.Redis, "appSignalrBackplane");
            GlobalHost.DependencyResolver.UseStackExchangeRedis(scaleoutConfig);

            // Any connection or hub wire up and configuration should go here
            app.MapSignalR();
        }
    }
}

但是,它似乎不起作用.根本不再发送推送通知,我尝试使用 redis-cli 手动订阅频道,但没有发布任何内容.没有错误,我尝试将连接详细信息手动输入到 UseStackExhangeRedis 函数中,而不是像链接的演示中那样使用 RedisScaleoutConfiguration ,但它没有帮助.

However, it doesn't seem to be working. Push notifications are no longer sent at all, and I tried manually subscribing to the channel using redis-cli and nothing is being published. There are no errors and I have tried manually entering the connection details into the UseStackExhangeRedis function instead of using the RedisScaleoutConfiguration as in the demo linked, but it hasn't helped.

推荐答案

最后,我找到了在 Signalr 中启用跟踪的方法:https://docs.microsoft.com/en-us/aspnet/signalr/overview/testing-and-debugging/enabling-signalr-tracing

In the end, I found a way to enable tracing in Signalr: https://docs.microsoft.com/en-us/aspnet/signalr/overview/testing-and-debugging/enabling-signalr-tracing

使用跟踪我发现加载 dll 时出错 Error connected to Redis - System.InvalidOperationException: The assembly for System.Numerics.Vectors could not be loaded,所以我添加了一个重定向到web.config 并解决了问题

Using the tracing I found there was an error loading a dll Error connecting to Redis - System.InvalidOperationException: The assembly for System.Numerics.Vectors could not be loaded, so I added a redirect to the web.config and that fixed the issue

<dependentAssembly>
    <assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
</dependentAssembly>

这篇关于Signalr 使用 Redis 背板不传播消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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