问题描述
在给Signalr添加管道的时候,使用了异步,代码如下usingMicrosoft.AspNet.SignalR.Hubs;usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingMicrosoft.AspNet.SignalR;usingSystem.Threading.Tasks;usingMongoDB.Driver;namespaceSignalRDemo.Models{publicclassTaskModule:HubPipelineModule{privatevoidTest(){}publicasyncTask<long>T(){awaitTask.Delay(1000*2);thrownewException("测试错误");return10;}protectedoverridevoidOnAfterConnect(IHubhub){T().Wait();base.OnAfterConnect(hub);}}}
代码运行到T().Wait()就不往下面运行了,也不抛出任何错误,请各位大神帮忙看看什么问题
解决方案
时间: 2024-10-30 10:34:40