私はSignalR
、VS 2010 を使用して asp .net Web アプリケーションのクロスドメイン実装に取り組んでいます。
HubConnection()
私の問題は、アプリケーションからアクセスできないことです。SignalR バージョン 0.5.3 をインストールしました。の名前空間を検索しまし HubConnection()
たが、見つかりませんでした。HubConnection()
の名前空間またはアクセスできない理由を教えてください。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SignalR;
namespace SignalRVersion5
{
public partial class TestServerEvent : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
var connection = new HubConnection("http://localhost:58416/");
var chat = connection.CreateProxy("chat");
chat.On<string>("addMessage", Console.WriteLine);
try
{
connection.Start().Wait();
string msg = null;
while ((msg = Console.ReadLine()) != null)
{
chat.Invoke("send", msg).Wait();
}
}
catch (Exception ex)
{
using (var error = ex.GetError()) // NEW ERROR HANDLING FEATURES
{
Console.WriteLine(error.StatusCode);
}
}
}
}
}