skip to Main Content

My .NET Core 6 code runs perfectly on Visual Studio 2022, but when my app is published to a server running IIS, my SignalR functionality stops working.

JavaScript:

const connection = new signalR.HubConnectionBuilder().withUrl("/checkproduct").build();

program.cs:

app.MapHub<ProductHub>("/checkproduct");

Error Message:

Failed to load resource: the server responded with a status of 404 (Not Found) signalr.js:3082
[2024-01-22T06:11:53.892Z] Error: Failed to complete negotiation with the server: Error: Not Found
[2024-01-22T06:11:53.893Z] Error: Failed to start the connection: Error: Not Found

2

Answers


  1. enter image description here

    In Windows Features make sure u have checked the WebSocket Protocol and the issue will be resolved

    Login or Signup to reply.
  2. Based on your issue, I referred this doc and create simple demo, I publish it on IIS and it works fine.
    Taking the example in the documentation, make sure your static resource directory looks like this:
    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search