Search code examples
signalrblazor

Bad request from Blazor using Signalr after deployment on IIS


I have implemented a Blazor application with Signalr which works fine locally, but when I deploy it to a server with IIS it throws:

blazor.server.js:15 [2021-03-11T15:35:28.868Z] Error: System.Net.Http.HttpRequestException: Response status code does not indicate success: 400 (Bad Request). at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode() at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.NegotiateAsync(Uri url, HttpClient httpClient, ILogger logger, CancellationToken cancellationToken)

When I compare what Is happening locally with what is happening on the server it looks like it is this request that fails

[2021-03-11T15:54:20.865Z] Information: WebSocket connected to wss://localhost:44312/_blazor?id=VQLOPgZDJ-bXAb1CqhG1Vw.

I'd highly appreciate some help? If you need more information, let me know. I'd be glad to provide it for you.


Solution

  • Make sure the Websocket protocol is enabled in your IIS install. Do this via Roles and Features in Server Manager. Official documentation is here.