0

我在https://github.com/SignalR/SignalR/wiki/QuickStart-Hubs上通过他们的样本尝试了 signalR 集线器。

我设法使用他们的 asp.net 示例创建了一个 mvc 4 asp.net 应用程序,但是当我尝试调试控制台应用程序时:

public class Program
{
   public static void Main(string[] args)
    {
        // Connect to the service
        var hubConnection = new HubConnection("http://localhost/5623");

        // Create a proxy to the chat service
        var chat = hubConnection.CreateHubProxy("chat");

        // Print the message when it comes in
        chat.On("addMessage", message => Console.WriteLine(message));

        // Start the connection
        hubConnection.Start().Wait();

        string line = null;
        while((line = Console.ReadLine()) != null)
        {
            // Send a message to the server
            chat.Invoke("Send", line).Wait();
        }
    }
}

它在hubConnection.Start().Wait()处向我发送异常;说{“远程服务器返回错误:(500)内部服务器错误。”}

我认为它与有关http://localhost/5623,我尝试http://localhost/5623/Homehttp://localhost/5623/Home/Chat得到{"The remote server returned an error: (404) Not Found."}错误。

请问我该如何解决这个问题。

谢谢你。

4

0 回答 0