I had a problem deploying a very simple MVC5 application with SignalR 2.0.2 signal. Everything works fine in my local development environment when I run it using IIS Express. When I deploy to IIS, my js gets a 404 error trying to connect to SignalR.
In particular, I am deploying an application / virtual directory that runs under my website by default. When I publish directly to the default website, everything works successfully, so IIS is not a problem.
GET http: // myServer / signalr /negotiate?connectionData=%5B%5D&clientProtocol=1.3&_=1395517687175 404 (not found)
I assume 404 is caused by a missing application name. i.e.: myServer / MyApp / signalr / negotiate ...
I searched for a few posts and SignalR documentation with no luck regarding IIS and applications / virtual directories and SignalR. The following are snippets of code in my application.
Thank!
JS:
var connection = $.hubConnection();
var proxy = connection.createHubProxy('TestHub');
connection.start()
.done(function () {
console.log('Now connected, connection ID=' + connection.id + ' using transport=' + connection.transport.name);
})
.fail(function () { console.log('Could not connect'); });
Startup.cs:
app.MapSignalR();
Update
By changing the following JS code, I was able to “fix” the problem. The question is how true is this?
var connection = $.hubConnection("/MyApp/signalr", { useDefaultPath: false });
source
share