Events
Power BI DataViz World Championships
14 Feb, 16 - 31 Mar, 16
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This section provides help with errors that can occur when trying to establish a connection to an ASP.NET Core SignalR hub.
When using WebSockets and skipNegotiation = true
WebSocket connection to 'wss://xxx/HubName' failed: Error during WebSocket handshake: Unexpected response code: 404
When using multiple servers without sticky sessions, the connection can start on one server and then switch to another server. The other server is not aware of the previous connection.
Verify the client is connecting to the correct endpoint. For example, the server is hosted at http://127.0.0.1:5000/hub/myHub
and client is trying to connect to http://127.0.0.1:5000/myHub
.
If the connection uses the ID and takes too long to send a request to the server after the negotiate, the server:
For the following error:
WebSocket connection to 'wss://xxx/HubName' failed: Error during WebSocket handshake: Unexpected response code: 400
Error: Failed to start the connection: Error: There was an error with the transport.
This error is usually caused by a client using only the WebSockets transport but the WebSocket protocol isn't enabled on the server.
When using WebSockets and skipNegotiation = true
WebSocket connection to 'ws://xxx/HubName' failed: Error during WebSocket handshake: Unexpected response code: 307
This error can also happen during the negotiate request.
Common cause:
UseHttpsRedirection
in Startup
, or enforces HTTPS via URL rewrite rule.Possible solution:
.withUrl("https://xxx/HubName")
Http status code 405 - Method Not Allowed
Http status code 0 - Usually a CORS issue, no status code is given
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:5000/default/negotiate?negotiateVersion=1. (Reason: CORS header 'Access-Control-Allow-Origin' missing).
.WithOrigins(...)
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:5000/default/negotiate?negotiateVersion=1. (Reason: expected 'true' in CORS header 'Access-Control-Allow-Credentials').
.AllowCredentials()
to your CORS policy. Cannot use .AllowAnyOrigin()
or .WithOrigins("*")
with this optionHttp status code 413 - Payload Too Large
This is often caused by having an access token that is over 4k.
.AddAzureSignalR(options =>
{
options.ClaimsProvider = context => context.User.Claims;
});
Transient network failures may close the SignalR connection. The server may interpret the closed connection as a graceful client disconnect. To get more info on why a client disconnected in those cases gather logs from the client and server.
ASP.NET Core feedback
ASP.NET Core is an open source project. Select a link to provide feedback:
Events
Power BI DataViz World Championships
14 Feb, 16 - 31 Mar, 16
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreDocumentation
Logging and diagnostics in ASP.NET Core SignalR
Learn how to gather diagnostics from your ASP.NET Core SignalR app.
This article describes some common issues with developing SignalR applications.
Authentication and authorization in ASP.NET Core SignalR
Learn how to use authentication and authorization in ASP.NET Core SignalR.