使用Redis背板的Signalr未传播消息



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

[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,但没有帮助。

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

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

<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>

最新更新