信号器不在IIS 8中调用客户端javascript函数

时间:2015-10-26 13:14:19

标签: iis signalr

我目前有一个信号器Web应用程序,托管在IIS 8.5中。我的应用程序在本地运行良好,但当它在IIS网络服务器中托管时,信号器中心无法向客户端发出任何回叫。

使用fiddler,我在调用后发现了以下异常:

The connection to '' failed. 
Error: TimedOut (0x274c). 
System.Net.Sockets.SocketException A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 

它向错误的IP地址和端口发出get请求,这不是我的网站地址。

我正在使用webSockets。

Javascript代码:

 function backEndFactory(serverUrl, hubName) {
    var connection = $.hubConnection("localhost");
    connection.logging = true;
    var proxy = connection.createHubProxy(hubName);

    connection.start({ transport: ['webSockets'] }).done(function () { });

    return {
        // signal r server call this callback
        on: function (eventName, callback) {
            proxy.on(eventName, function (result) {
                $rootScope.$apply(function () {
                    if (callback) {
                        // call the client function passing in the return data from the server
                        callback(result);
                    }
                });
            })
        },

        //  call signal r server function
        invoke: function (methodName, callback) {
            proxy.invoke(methodName).done(function (result) {
                $rootScope.$apply(function () {
                    if (callback) {
                        // return data after calling method in signal r server
                        callback(result);
                    }
                })
            })
        }
    }
}


var dashboardHub = proxy(serverUrl, hubName);
        dashboardHub.on("ClientsUpdateBirthdays", function (data) {
            $scope.birthdays = data;
        });

0 个答案:

没有答案