I have a .net core web application with signalR elements which works pretty fine locally.
When I publish the application on my host (windows server, plesk, .net framework 4.8), I get an error as follows:
Backend
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.AspNet.SignalR;
public class ChatHub : Hub
{
public void SendAll(string userid, string message)
{
(new Messages()).addMessage(message, DateTime.Now, userid);
string name = (new Users(userid)).getname();
Clients.All.broadcastMessage(name, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), message);
}
}
Header
\<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" type="text/javascript"\>\</script\>
\<script src="https://cdnjs.cloudflare.com/ajax/libs/signalr.js/2.4.1/jquery.signalR.min.js"\>\</script\>
JS
$.connection.hub.url = "/signalr";
$.connection.hub.start({ transport: 'longPolling' }).done(function() {
console.log("hub connection is made");
}).fail(function() {
console.log("connection to the hub has been failed");
});