I have a project that uses SignalR (uses tutorial from https://gkulshrestha.wordpress.com/2014/05/02/signalr-with-sql-server-query-notification/) When I run it from visual studio, my project works perfectly. However, when I run it on a server (after having published it and with IIS), it doesn't work.
Specifically, I found out that a certain part of the JS is not running. I have
@section Scripts{
<script src="/Scripts/jquery.signalR-2.1.1.js"></script>
<!--Reference the autogenerated SignalR hub script. -->
<script src="/signalr/hubs"></script>
<script type="text/javascript">
$(function () {
// Reference the auto-generated proxy for the hub.
alert(1);
var clientHub = $.connection.messageSender;
alert(5);
// Create a function that the hub can call back to display messages.
clientHub.client.broadcastMessage = function (message) {
// Add the message to page.
$('#messagecontainer').append('<li>' + message + '</li>');
};
alert(2);
$.connection.hub.start().done(function () {
alert("connection started")
}).fail(function (e) {
alert(e);
});
alert(3);
});
</script>
}
When running this through visual studio, I hit all the alerts in here. When running it on the server (by pressing Browse), I only hit alert(1) and none of the others.
Any help would be appreciated! Thanks!
[edit] I've looked around and I'm suspecting it has to do with my signalr/hubs reference. I've tried everything on SignalR /signalr/hubs 404 Not Found but no luck.