Forum Discussion

Olof's avatar
Olof
Icon for Nimbostratus rankNimbostratus
Sep 18, 2025

APM webtop – problem with websockets for Serverside Blazor app

Dear community, 

 

We have a web application built with Blazor server side rendering that utilizes SignalR (websockets) and runs on a Windows server with IIS (i.e. not web assembly).

 

Virtual sever: the site runs as intended!

 

Webtop + virtual sever: The site will render and SSO works, but any page using SignalR will loose interactivity as the websocket handshake times out.

 

We have tried to disable websockets on the server which makes SignalR use long polling as a fallback. The web browser displays a different error message but behaves the same otherwise (have not dug deeper as we intend to use websockets in production).

 

I would greatly appreciate any guidance on what to do!

 

This is the log from the blazor web app (behind webtop + virtual server):

2025-09-18 16:50:26    Debug    Microsoft.AspNetCore.SignalR.Internal.DefaultHubProtocolResolver    Registered SignalR Protocol: json, implemented by Microsoft.AspNetCore.SignalR.Protocol.JsonHubProtocol.
2025-09-18 16:50:26    Debug    Microsoft.AspNetCore.SignalR.Internal.DefaultHubProtocolResolver    Registered SignalR Protocol: blazorpack, implemented by Microsoft.AspNetCore.Components.Server.BlazorPack.BlazorPackHubProtocol.
2025-09-18 16:50:27    Debug    Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionManager    New connection XQNqGM4oGkm0P1v4NECJ9g created.
2025-09-18 16:50:27    Debug    Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionDispatcher    Sending negotiation response.
2025-09-18 16:50:27    Debug    Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionDispatcher    Establishing new connection.
2025-09-18 16:50:27    Debug    Microsoft.AspNetCore.SignalR.HubConnectionHandler    OnConnectedAsync started.
2025-09-18 16:50:27    Debug    Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport    Socket opened using Sub-Protocol: '(null)'.
2025-09-18 16:50:42    Debug    Microsoft.AspNetCore.SignalR.HubConnectionContext    Handshake was canceled.
2025-09-18 16:50:42    Debug    Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport    Waiting for the client to close the socket.
2025-09-18 16:50:42    Debug    Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport    Socket closed.
2025-09-18 16:50:42    Debug    Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionManager    Removing connection xVt0cL2a0gpMOiJROyJxhw from the list of connections.

 

This is the log from the same blazor web app when it works as intended

2025-09-18 17:29:31    Debug    Microsoft.AspNetCore.SignalR.Internal.DefaultHubProtocolResolver    Registered SignalR Protocol: json, implemented by Microsoft.AspNetCore.SignalR.Protocol.JsonHubProtocol.
2025-09-18 17:29:31    Debug    Microsoft.AspNetCore.SignalR.Internal.DefaultHubProtocolResolver    Registered SignalR Protocol: blazorpack, implemented by Microsoft.AspNetCore.Components.Server.BlazorPack.BlazorPackHubProtocol.
2025-09-18 17:29:37    Debug    Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionManager    New connection c0CR_c-7xa0QydeddE5HcA created.
2025-09-18 17:29:37    Debug    Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionDispatcher    Sending negotiation response.
2025-09-18 17:29:37    Debug    Microsoft.AspNetCore.SignalR.HubConnectionHandler    OnConnectedAsync started.
2025-09-18 17:29:37    Debug    Microsoft.AspNetCore.Http.Connections.Internal.Transports.WebSocketsTransport    Socket opened using Sub-Protocol: '(null)'.
2025-09-18 17:29:37    Debug    Microsoft.AspNetCore.SignalR.Internal.DefaultHubProtocolResolver    Found protocol implementation for requested protocol: blazorpack.
2025-09-18 17:29:37    Debug    Microsoft.AspNetCore.SignalR.HubConnectionContext    Completed connection handshake. Using HubProtocol 'blazorpack'.
2025-09-18 17:29:37    Debug    Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher    Received hub invocation: InvocationMessage { InvocationId: "0", Target: "StartCircuit", Arguments: [ https://testsite.com/, https://testsite.com/counter, [], CfD...m ], StreamIds: [  ] }.
2025-09-18 17:29:37    Debug    Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher    Received hub invocation: InvocationMessage { InvocationId: "", Target: "EndInvokeJSFromDotNet", Arguments: [ 2, True, [2,true,null] ], StreamIds: [  ] }.
2025-09-18 17:29:37    Debug    Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher    Received hub invocation: InvocationMessage { InvocationId: "", Target: "UpdateRootComponents", Arguments: [ {"batchId":1,"operations":[{"type":"add","ssrComponentId":1,"marker":{"type":"server","prerenderId":"80...9c8","key":{"locationHash":"....","formattedComponentKey":""},"sequence":0,"descriptor":".... ], StreamIds: [  ] }.
2025-09-18 17:29:37    Debug    Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher    Received hub invocation: InvocationMessage { InvocationId: "", Target: "OnRenderCompleted", Arguments: [ 2,  ], StreamIds: [  ] }.

 

This is the output in the web browser console when accessing the site via (webtop + virtual server):

2025-09-18T14:50:28.565Z    Information:     Normalizing '_blazor' to 'https://testsite.com/f5-w-68747470733a2f2f6d6139392e6d6963726f2d746573742e696e747261$$/f5-h-$$/_blazor'.    blazor.web.js?F5CH=J:1
2025-09-18T14:50:28.609Z    Information:     WebSocket connected to wss://testsite.com/f5-w-68747470733a2f2f6d6139392e6d6963726f2d746573742e696e747261$$/f5-h-$$/_blazor?id=xVt0cL2a0gpMOiJROyJxhw.    blazor.web.js?F5CH=J:1 
2025-09-18T14:50:43.620Z    Error:     Connection disconnected with error 'Error: Server returned handshake error: Handshake was canceled.'.    blazor.web.js?F5CH=J:1 
2025-09-18T14:50:43.620Z    Error:    Error: Server returned handshake error: Handshake was canceled.    blazor.web.js?F5CH=J:1 
2025-09-18T14:50:43.620Z    Error:     Failed to start the circuit.    blazor.web.js?F5CH=J:1 

3 Replies

  • Hi Olof,

     

    Have you tried to add a websocket profile to the VS  ? For client side websocket profile you might need to toggle mask payload:  

     select Remask (default; unmasks client frames for proxying/inspection, then remasks for the backend).

    Use Preserve if no inspection is needed (performance with binary BlazorPack payloads in SignalR) or if remasking causes issues.

     

    Also consider extending the handshake timeout on the Blazer app config.  Best to eliminate a timeout value maybe set for 45 or 60 seconds...Re-test and see if the handshake timeout is still appearing.  I think the underlying issue is a proxying/websocket framing issue.  

  • Olof's avatar
    Olof
    Icon for Nimbostratus rankNimbostratus

    Hi Jeffrey,

    Thank you for the response!

     

    We have tried the WebSocket profile now (with and without preserve), but unfortunately the handshake still times out.

    I adjusted the handshake timeout in the Blazor app, but it only delays the error message. 

     

    A colleague found an article that hinted it might be an issue with javascript versions: https://my.f5.com/manage/s/article/K15142093 

     

    We have written very few javascripts for the app and tried deactivating them completely without effect. But Blazor generates a “blazor.web.js” script that is served to the client. 

    I haven’t found any clear information about the javascript version in that script, but an issue on github had a complaint about “high version syntax”. That issue regarded .NET9 and we use .NET8, but the issue was resolved with a comment that Microsoft only supports the latest web browsers: https://github.com/dotnet/aspnetcore/issues/59090

    Could javascript version be the issue?