I was working on ASP.NET Core SignalR client application to receive the message from the SignalR hub. This is the scenario where my SignalR server and client were two separate .NET Core applications. In the client application, I got the below error message while trying to receive the message from SignalR Hub. This error may arise and the solution is almost similar for both cases using SignalR Javascript client and .NET Client.

Exact Error Message: “Error: Failed to complete negotiation with the server: Error: Not Found: Status code ‘404’ Either this is not a SignalR endpoint or there is a proxy blocking the connection.”

Earlier code:

var connection = new signalR.HubConnectionBuilder().withUrl("http://localhost:39823/event-hub)

Then to resolve the above error I found that we need to add the below code in HubConnectionBuilder.

skipNegotiation: true,
transport: signalR.HttpTransportType.WebSockets

Note that: The negotiation should be skipped only when the transport property is set to ‘signalR.HttpTransportType.WebSockets‘.

Solution

Below is the earlier code with the error.

var connection = new signalR.HubConnectionBuilder().withUrl("http://localhost:4023/yourevent)

Complete code to resolve the issue.

var connection = new signalR.HubConnectionBuilder().withUrl("http://localhost:4023/yourevent", {
    skipNegotiation: true,
    transport: signalR.HttpTransportType.WebSockets
})

Note: This solution is applicable for both cases either using SignalR .NET Client or SignalR JavaScript client.

3 thoughts on “Resolve: SignalR Error: Failed to complete negotiation with the server”
  1. What’s up, I read your new stuff on a regular basis.
    Your story-telling style is awesome, keep up the good work!

  2. We stumbled over here by a different weeb pag and thought I might as well check things out.
    I like what I see so now i am following you.

    Loook forward to looking at your web page for a second
    time.

  3. I’ve been exploring for a little for any high-quality articles or blog posts on this sort of
    space . Exploring in Yahoo I eventually stumbled upon this site.

    Reading this info So i’m satisfied to express that I’ve a very just right
    uncanny feeling I discovered exactly what I needed.

    I such a lot no doubt will make certain to do not fail to remember this website
    and give it a look on a constant basis.

Leave a Reply

Your email address will not be published. Required fields are marked *