Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ';System.AggregateException';发生在mscorlib.dll”;使用信号机时_C#_.net_Signalr_Unhandled Exception - Fatal编程技术网

C# ';System.AggregateException';发生在mscorlib.dll”;使用信号机时

C# ';System.AggregateException';发生在mscorlib.dll”;使用信号机时,c#,.net,signalr,unhandled-exception,C#,.net,Signalr,Unhandled Exception,考虑以下代码: 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 { g

考虑以下代码:

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

使用Microsoft.AspNet.signal.Client;
使用制度;
使用System.Collections.Generic;
使用System.Linq;
使用系统文本;
使用System.Threading.Tasks;
命名空间控制台应用程序1
{
类别股票
{
公共字符串符号{get;set;}
公共十进制价格{get;set;}
}
班级计划
{
静态void Main(字符串[]参数)
{
var hubConnection=新的hubConnection(“http://www.contoso.com/");
IHubProxy stockTickerHubProxy=hubConnection.CreateHubProxy(“StockTickerHub”);
stockTickerHubProxy.On(“UpdateStockPrice”,stock=>Console.WriteLine(“股票更新为{0}新价格{1}”,stock.Symbol,stock.price));
hubConnection.Start().Wait();
Console.ReadLine();
}
}
}
运行时,我得到“mscorlib.dll中发生了“System.AggregateException”类型的未处理异常”。我尝试了这个问题的公认答案,但我不知道如何实际填写表格。如何获得此代码示例中出错的详细信息?以下是“例外”窗口对我来说的样子:


正如帕特里克·埃克布雷希特(Patrick Eckebrecht)在对这个问题的评论中所指出的,点击“查看详细信息”就足以找到异常的原因:


Visual Studio显示了一个异常窗口,其中包含指向更多详细信息的链接。您显示给我们的窗口只是VisualStudio的设置窗口。