blazorr.server.js Error: WebSocket closed with status code: 1006 (no reason given) on IIS server.

40296506 0 Reputation points
2023-12-24T12:24:51.55+00:00

Hi everyone, I am developing a .NET 8 Razor Pages web app and I have added a Blazor-server-side component to it.

My app works when I run it in Visual Studio 2022.

However, when I publish it on a local IIS (I have tested it on IIS manager) it works fine (the component works but I got this warning message in the console:

Warning: Failed to connect via WebSockets, using the Long Polling fallback transport. This may be due to a VPN or proxy blocking the connection. To troubleshoot this, visit https://aka.ms/blazor-server-using-fallback-long-polling.

When I publish the app to a real IIS server, the component freezes and I got the following message in the console:

Error: Connection disconnected with error 'Error: WebSocket closed with status code: 1006 (no reason given).'.

Error: Error: WebSocket closed with status code: 1006 (no reason given).

Error: Failed to start the circuit.

Developer technologies ASP.NET ASP.NET Core
Developer technologies .NET Blazor
{count} votes

2 answers

Sort by: Most helpful
  1. AgaveJoe 30,126 Reputation points
    2023-12-24T12:36:41.7233333+00:00

    Are Web Sockets installed on the server?

    IIS 8.0 WebSocket Protocol Support


  2. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2023-12-24T17:43:49.4933333+00:00

    The server message says the server can not open a websocket, so it falling back to signalr polling.

    the client code has probably been configured to only support websockets.

    as suggested you need to enable websockets on the server, or enable long polling on the client.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.