.NET 4.8 | SignalR connection to server behind Load balancer | On Premise

Prashant Jain 1 Reputation point
2022-04-09T19:38:21.393+00:00

Hi,

I am trying to connect my angular-12 client to SignalR service on a server which is behind load balancer.
After successful SignalR negotiation
a) (/signalr/negotiate?clientProtocol=2.1&connectionData=d&_=xtz -[200-OK] ),
next request which can be seen on the client is of ABORT
b) (*/signalr/abort?transport=longPolling&clientProtocol=2.11&connectionToken=t&_=abc [200-OK] )

Stack being used

  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
  10. System works well for a single node environment. Chrome's network tab shows client has following endpoint communication

We are facing an issue of client connection to the app server
I've a feeling of LoadBalancer causing this issue. I am not in favour of using stick session.
Can someone please tell what needs to be done to address this issue.

Regards
Prashant

Azure SignalR Service
Azure SignalR Service
An Azure service that is used for adding real-time communications to web applications.
120 questions
Azure Load Balancer
Azure Load Balancer
An Azure service that delivers high availability and network performance to applications.
404 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Takahito Iwasa 4,841 Reputation points MVP
    2022-04-09T22:15:15.193+00:00

    Hi, @Prashant Jain

    I am not in favour of using stick session.

    Are you fixing the session now?
    You need to fix the session according to:
    https://learn.microsoft.com/en-us/aspnet/core/signalr/scale?view=aspnetcore-6.0


  2. Bruce (SqlWork.com) 56,846 Reputation points
    2022-04-10T01:03:55.583+00:00

    You need to use sticky sessions to support reconnects and non websocket connections. Be sure your load balancer supports persistent websocket connections.


  3. Heera Hemanth Bylla 1 Reputation point
    2022-04-11T10:55:34.35+00:00

    Hi @Takahito Iwasa , @Bruce (SqlWork.com) , @Prashant Jain

    Trying to build a SignalR web app, using .Net framework [4.8] server and Angular client [12]

    Don't see the option skipNegotiation in the Signalr node package.

    So, can I use the @aspnet/signalr package and implement the option with the same app setup?

    0 comments No comments

  4. Prashant Jain 1 Reputation point
    2022-04-11T10:57:14.647+00:00

    same issue @Heera Hemanth Bylla

    Hi
    @Takahito Iwasa , @Bruce (SqlWork.com)

    Trying to build a SignalR web app, using .Net framework [4.8] server and Angular client [12]
    I don't see the option skipNegotiation in the Signalr node package.
    So, can I use the @aspnet/signalr package and implement the option with the same app setup?

    Regards
    Prashant

    0 comments No comments