1
  1. Dotnet Framework: 4.8
  2. SignalR nuget package: 2.4.0
  3. Angular client using Signalr: "^2.4.2",
  4. Two nodes application server behind load balancer.
  5. Web socket support configured on IIS. (IIS latest version on Windows Server 2016)
  6. Web socket is the only transport protocol present in the client side code
  7. ASP.NET Web API application hosted on IIS
  8. SQL Server-2016 as broker to pass notification on Datachange
  9. Passing notification to requesting client using connectionId

System works well for a single node environment. Chrome's network tab shows client has following endpoint communication

  • /signalr/negotiate?clientProtocol=2.1&connectionData=d&_=xtz -[200-OK]
  • /signalr/start?transport=webSockets&clientProtocol=2.1&connectionToken=t&_=abc [200-OK]

However, when we try to connect to appServer under a Load Balancer, We are facing an issue of client connection to the app server

System shows the below logs when requests are intercept via Fiddler for Load Balanced environment.

  • /signalr/negotiate?clientProtocol=2.1&connectionData=d&_=xtz -[200-OK]
  • /signalr/start?transport=transport=serverSentEvents&clientProtocol=2.1&connectionToken=t&_=abc -[404-NOTFOUND]
  • /signalr/start?transport=transport=longPolling&clientProtocol=2.1&connectionToken=t&_=abc -[404-NOTFOUND]
  • /signalr/abort?transport=longPolling&clientProtocol=2.11&connectionToken=t&_=abc -[200]

I've a feeling of LoadBalancer causing this issue.Not in favour of using stick session Can someone please tell what needs to be done to address this issue.

Regards

Prashant
  • 21
  • 4
  • 1
    > SQL Server-2016 as broker to pass notification on Datachange Are you using the signalr sql scaleout? – davidfowl Apr 11 '22 at 06:06
  • 1
    Yes, we are trying to use sql as backplane – – Prashant Apr 12 '22 at 08:15
  • We are having the same issue using Redis as a broker. See https://stackoverflow.com/questions/68642118/asp-net-signalr-with-redis-scaleout-backplane-causes-linear-increase-in-server-l At the end, we decided to replace SignalR with another system. – eglease Jun 10 '22 at 15:31

1 Answers1

0

Since web-socket in its nature is sticky (you have an open channel between one specific client and one specific server in the load-balanced-set) you MUST use sticky session in Load-balancer.

At least if you want the start call to reach the same server-node as negotiate calls used.

Anything else is like asking for random spurious errors.

Hans Karlsen
  • 2,275
  • 1
  • 15
  • 15