我一直在尝试连接到本教程中创建的Windows服务:
http://www.asp.net/signalr/overview/deployment/tutorial-signalr-self-host
问题是我可以使用自己的客户端连接到它。但是,我试图从控制台应用程序连接到它并没有成功。此外,如果我在控制台应用程序中托管SignalR Hub,我可以成功连接到它。
我收到的错误表明我的客户端版本与服务器不兼容,并且连接被拒绝。
这就是我尝试连接的方式:
IHubProxy _hub;
string url = @"http://localhost:8080/";
var connection = new HubConnection(url);
_hub = connection.CreateHubProxy("MyHub");
_hub.On("addMessage", x => ShowMessage(x));
connection.Start().Wait();
更新:
-Errors讯息:
1
Exception:Caught: "You are using a version of the client that isn't compatible with the server. Client version 1.4, server version 1.3." (System.InvalidOperationException)
A System.InvalidOperationException was caught: "You are using a version of the client that isn't compatible with the server. Client version 1.4, server version 1.3."
Time: 2/20/2015 12:03:36 PM
Thread:Worker Thread[5924]
2
Exception:Thrown: "No connection could be made because the target machine actively refused it" (System.Net.Sockets.SocketException)
A System.Net.Sockets.SocketException was thrown: "No connection could be made because the target machine actively refused it"
Time: 2/20/2015 12:03:36 PM
Thread:Worker Thread[3320]
答案 0 :(得分:0)
正如Christophe所指出的,这个问题与SignalR Java client only supports exactly 1.3重复,在我的情况下,通过卸载并重新安装所有SignalR / Owin软件包来解决。