Failed to complete negotiation with the server .NET Origin: Application & API Last updated 13 Oct 2026

SignalR: Error: Failed to complete negotiation with the server / Failed to start the connection

The SignalR client couldn’t negotiate with the hub — wrong URL, CORS, authentication, or a proxy that blocks WebSockets/negotiate requests.

Exact message you may see Failed to complete negotiation with the serverFailed to start the connectionError: Failed to start the transport 'WebSockets'
Seen on: .NET

Meaning

Negotiate is a POST to /hub/negotiate. 404 means wrong path/MapHub, CORS errors require AllowCredentials with specific origins, 401 means the token wasn’t sent (use accessTokenFactory). Load balancers need sticky sessions unless using SkipNegotiation with WebSockets.

Common causes

  • Hub URL or MapHub path mismatch
  • CORS not allowing the client origin with credentials
  • Missing auth token (accessTokenFactory)
  • Proxy/load balancer without WebSocket support or sticky sessions

⚡ Quick fix

  1. Check the network tab for the negotiate response code
  2. Configure CORS with WithOrigins + AllowCredentials
  3. Pass tokens via accessTokenFactory; enable sticky sessions or Azure SignalR

Detailed fix by platform

JavaScript

  1. javascript
    const conn = new signalR.HubConnectionBuilder()
      .withUrl("https://api.example.com/hubs/chat", { accessTokenFactory: () => token })
      .withAutomaticReconnect()
      .build();

How to diagnose

  1. Negotiate — Status code
  2. CORS — Console errors
  3. Proxy — WebSockets allowed?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

An unhandled error has occurred — Blazor: An unhandled error has occurred. Reload 🗙 (.NET)An unhandled error ha…antiforgery token could not be decrypted — ASP.NET Core: The antiforgery token could not be decrypted / The required antiforgery cookie is not present (400 Bad Request) (.NET)antiforgery token cou…Cannot access a disposed context instance — ObjectDisposedException: Cannot access a disposed context instance (.NET)Cannot access a dispo…CORS — CORS Error: No 'Access-Control-Allow-Origin' header is present (API)CORSCORS wildcard with credentials — ASP.NET Core: The CORS protocol does not allow specifying a wildcard (any) origin and credentials at the same time (.NET)CORS wildcard with cr…The request matched multiple endpoints — AmbiguousMatchException: The request matched multiple endpoints. Matches: X, Y (.NET)The request matched m…WebSocket failed — WebSocket connection to 'wss://x' failed (JavaScript)WebSocket failedFailed to…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.