azure-signalr
azure-signalr copied to clipboard
Can't track reason for "Error when processing messages."
- .NET Framework 4.7.1
- jQuery-signalR-2.4.1
- Microsoft.Azure.SignalR.AspNet 1.7.1
- Azure SignalR Service Configuration in Portal = CORS: *, Service Mode = Default, Tier = Standard
I am getting this error every time I'm trying to send messages:
Microsoft.Azure.SignalR Error: 0 : [Microsoft.Azure.SignalR.AspNet.ServiceConnection]Error when processing messages. Id: 0cb6304d-88de-42d2-a8ad-3ddee974b975
The error occurs in Microsoft.Azure.SignalR.AspNet.ServiceConnection: https://github.com/Azure/azure-signalr/blob/9a850fb50772d81fb30a093465d603c094be656a/src/Microsoft.Azure.SignalR.Common/ServiceConnections/ServiceConnectionBase.cs#L595-L596
https://github.com/Azure/azure-signalr/blob/9a850fb50772d81fb30a093465d603c094be656a/src/Microsoft.Azure.SignalR.Common/ServiceConnections/ServiceConnectionBase.cs#L486-L491
The error message is too generic, and the context of the exceptioin is lost and not trackable. Also, There is no reference as to how this error occurs or can be solved.
Startup.cs:
var applicationName = Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME") ?? Environment.MachineName;
var hubConfiguration = new HubConfiguration
{
EnableDetailedErrors = true,
};
app.MapAzureSignalR(applicationName, hubConfiguration);
GlobalHost.TraceManager.Switch.Level = SourceLevels.Information;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
Both the server and the client reports that they are conencted with the hub.
Microsoft.Azure.SignalR Information: 0 : [Microsoft.Azure.SignalR.Connections.Client.Internal.WebSocketsTransport]Starting transport. Transfer mode: Binary. Url: 'wss://xxxxxxx.service.signalr.net/aspnetserver/?hub=xxxxx_xxxxxxxxhub&cid=f79a513e-bf52-4fb0-8fc4-09278bdffe2b&target=3d36cdd5-8aa2-4853-bbc2-3aa27fbfe792'.

If it is locally repro-able, you can follow this tip to catch the exception thrown: https://docs.microsoft.com/en-us/azure/azure-signalr/signalr-howto-troubleshoot-guide#troubleshooting-guide
Great, thanks for that tip. Not sure if it is an optimal way of doing debugging - I still think the underlying cause should be more available.
For me the problem was System.Threading.Channels. Microsoft.Azure.SignalR.AspNet 1.7.1 depends on System.Threading.Channels 4.6.0. I am also using StackEchange Redis (2.1.58) which depends on System.Threading.Channels 4.7.1.
An assembly redirect solved my problem:
<dependentAssembly>
<assemblyIdentity name="System.Threading.Channels" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0"/>
</dependentAssembly>