API serving signalr service (websockets only) is hosted on IIS (webgarden - 3 worker processes, one server) and is configured with the redis backplane:
services.AddSignalR(options =>
{
options.EnableDetailedErrors = true;
})
.AddStackExchangeRedis(async options =>
{
options.ConnectionFactory = async writer =>
{
var config = new ConfigurationOptions()
{
AbortOnConnectFail = false
};
config.EndPoints.Add("address", port);
config.Ssl = false;
config.SyncTimeout = 2000;
config.DefaultDatabase = x;
config.ClientName = "api1";
config.ChannelPrefix = "api1";
var connection = await ConnectionMultiplexer.ConnectAsync(config, writer);
connection.ConnectionFailed += (_, e) =>
{
Log.Information ("Connection to Redis failed.");
};
connection.InternalError += (_, e) =>
{
Log.Information("Connection to Redis failed with internal error.");
};
if (!connection.IsConnected)
{
Log.Information("Did not connect to Redis.");
}
if (connection.IsConnected)
{
Log.Information("Connected to Redis.");
}
return connection;
};
})
Web application communicates with that signalr service (via angular). App uses the following connection properites:
skipNegotiation: true,
transport: WebSockets
After authorization there is a connection with valid connectionId. Problem occurs (sometimes) after refreshing that page and I receive the following error message:
WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.
Did I miss something in my configuration? In the log file I see only "Connected to Redis." according to the code I have posted.