连接到 Windows 服务中自托管的 SignalR 时出现问题

Problems to connect to a SignalR Self-Hosted in a Windows Service

我一直在尝试连接到本教程中创建的 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();

更新:

-错误消息:

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]

正如 Christophe 所指出的,这个问题与 SignalR Java client only supports exactly 1.3 重复,就我而言,通过卸载并重新安装所有 SignalR/Owin 包解决了这个问题。