I have an application that uses SignalR to communicate between clients and servers. Everything runs finally locally but when I deploy to an Azure virtual machine I get the following exception at regular intervals:
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets[14] Connection id "0HLH19P3L3KJB" communication error. System.IO.IOException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketAwaitable.GetResult() at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketConnection.ProcessReceives() at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal.SocketConnection.DoReceive() --- End of inner exception stack trace ---
I have read up on all the Timeout-related stuff wrt SignalR and the consensus seems to be that leaving the default settings as they are should work just fine, so I haven't attempted to tweak any of the settings yet.
Is this exception something I should expect, and should handle, or is it something out of the ordinary that I should be trying to solve at source? Is there anything I should be looking for in the Azure VM config that could be causing this? Or should I be playing with the timeout settings on SignalR itself?
EDIT some more detail one the exception:
ystem.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake. ---> System.IO.IOException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
And some info from wireshark
In the end, I solved this issue by implementing a client-side ping. I invoke a void Ping() method on the server hub every ten seconds and all is well.
User contributions licensed under CC BY-SA 3.0