Signalr 编码Webtest中的信号器持久连接

Signalr 编码Webtest中的信号器持久连接,signalr,webtest,persistent-connection,Signalr,Webtest,Persistent Connection,我在控制台应用程序中有以下代码: var connection = new Connection("http://localhost/xxx/signalr"); connection.Error += ex => { string msg = string.Format("***SignalR Error: {0}", ex.ToString()); Debug.WriteLine(msg); }; connection.Received += data => {

我在控制台应用程序中有以下代码:

var connection = new Connection("http://localhost/xxx/signalr");
connection.Error += ex =>
{
    string msg = string.Format("***SignalR Error: {0}", ex.ToString());
    Debug.WriteLine(msg);
};
connection.Received += data =>
{
    string msg = string.Format("***SignalR Received: {0}", data);                    
    Debug.WriteLine(msg);
};
connection.Start().ContinueWith(task =>
{
    if (task.IsFaulted)
    {
        string msg = string.Format("***SignalR Failed to start: {0}", task.Exception.GetBaseException());
        Debug.WriteLine(msg);
    }
    else
    {
        string msg = string.Format("***SignalR Started: {0}", connection.ConnectionId);
        Debug.WriteLine(msg);
        connection.Send("Hello");
    }
});
调试服务器时,我可以看到调用了
OnConnected
OnReceived
。 如果在编码的WebTest中放置相同的代码,则会调用服务器上的
OnConnected
,但服务器上不会接收到
connection.Send

问:可以在WebTest中使用SignalR.Net客户端吗

问:在WebTest中使用SignalR持久连接的最佳方式是什么

谢谢