'System.AggregateException' occurred in mscorlib.dll” when using SignalR

拟墨画扇 提交于 2019-12-08 15:32:01

问题


Consider the following code:

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();
        }
    }
}

When run, I am getting "An unhandled exception of type 'System.AggregateException' occurred in mscorlib.dll". I tried the accepted answer from this question, but I had no idea how to actually fill the form there. How can I get details on what went wrong in this code sample? Here's what the "Exceptions" window looks like for me:


回答1:


As Patrick Eckebrecht noted in his comment to this question, it was enough to click "View Detail" to find the reason for the exception:



来源:https://stackoverflow.com/questions/30647119/system-aggregateexception-occurred-in-mscorlib-dll-when-using-signalr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!