使用 SignalR 时 'System.AggregateException' 发生在 mscorlib.dll”
'System.AggregateException' occurred in mscorlib.dll” when using SignalR
考虑以下代码:
using Microsoft.AspNet.SignalR.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Stock
{
public string Symbol { get; set; }
public decimal Price { get; set; }
}
class Program
{
static void Main(string[] args)
{
var hubConnection = new HubConnection("http://www.contoso.com/");
IHubProxy stockTickerHubProxy = hubConnection.CreateHubProxy("StockTickerHub");
stockTickerHubProxy.On<Stock>("UpdateStockPrice", stock => Console.WriteLine("Stock update for {0} new price {1}", stock.Symbol, stock.Price));
hubConnection.Start().Wait();
Console.ReadLine();
}
}
}
当 运行 时,我得到 "An unhandled exception of type 'System.AggregateException' occurred in mscorlib.dll"。我尝试了这个问题的公认答案,但我不知道如何在那里实际填写表格。我如何才能详细了解此代码示例中出现的问题?这是 "Exceptions" window 对我来说的样子:
正如 Patrick Eckebrecht 在他对这个问题的评论中指出的那样,单击 "View Detail" 即可找到异常原因:
考虑以下代码:
using Microsoft.AspNet.SignalR.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Stock
{
public string Symbol { get; set; }
public decimal Price { get; set; }
}
class Program
{
static void Main(string[] args)
{
var hubConnection = new HubConnection("http://www.contoso.com/");
IHubProxy stockTickerHubProxy = hubConnection.CreateHubProxy("StockTickerHub");
stockTickerHubProxy.On<Stock>("UpdateStockPrice", stock => Console.WriteLine("Stock update for {0} new price {1}", stock.Symbol, stock.Price));
hubConnection.Start().Wait();
Console.ReadLine();
}
}
}
当 运行 时,我得到 "An unhandled exception of type 'System.AggregateException' occurred in mscorlib.dll"。我尝试了这个问题的公认答案,但我不知道如何在那里实际填写表格。我如何才能详细了解此代码示例中出现的问题?这是 "Exceptions" window 对我来说的样子:
正如 Patrick Eckebrecht 在他对这个问题的评论中指出的那样,单击 "View Detail" 即可找到异常原因: