问题
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();
}
}
}
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.
回答1:
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
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>
来源:https://stackoverflow.com/questions/61274894/signalr-using-redis-backplane-not-propagating-message