3

我正在使用 SignalR 将有关长时间运行进程的消息发送回浏览器。我正在使用 System.Threading.ManualResetEventSlim 在单独的线程中运行。这是错误:

w3wp.exe Error: 0 : SignalR exception thrown by Task: System.AggregateException: One or
more errors occurred. ---> System.Web.HttpException: The remote host closed the 
connection. The error code is 0x80070057.
at System.Web.Hosting.IIS7WorkerRequest.RaiseCommunicationError(Int32 result, Boolean 
throwOnDisconnect)
at System.Web.Hosting.IIS7WorkerRequest.ExplicitFlush()
at System.Web.HttpResponse.Flush(Boolean finalFlush)
at System.Web.HttpResponse.Flush()
at System.Web.HttpResponseWrapper.Flush()
at Microsoft.Owin.Host.SystemWeb.CallStreams.OutputStream.Flush()
at Microsoft.AspNet.SignalR.Owin.ServerResponse.<Flush>b__0()
at Microsoft.AspNet.SignalR.TaskAsyncHelper.FromMethod(Action func)
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.Web.HttpException (0x80070057): The remote host closed     
the connection. The error code is 0x80070057.
at System.Web.Hosting.IIS7WorkerRequest.RaiseCommunicationError(Int32 result, Boolean   
throwOnDisconnect)
at System.Web.Hosting.IIS7WorkerRequest.ExplicitFlush()
at System.Web.HttpResponse.Flush(Boolean finalFlush)
at System.Web.HttpResponse.Flush()
at System.Web.HttpResponseWrapper.Flush()
at Microsoft.Owin.Host.SystemWeb.CallStreams.OutputStream.Flush()
at Microsoft.AspNet.SignalR.Owin.ServerResponse.<Flush>b__0()
at Microsoft.AspNet.SignalR.TaskAsyncHelper.FromMethod(Action func)<---

我在 SignalR 问题跟踪器上看到了一些类似的错误。有一些关于使用的东西:

 TaskScheduler.UnobservedTaskException += new EventHandler((s, arg) => 
 {
     arg.SetObserved();
     ((AggregateException)arg.Exception).Handle(ex =>
     {
         // Do something with ex (log or ignore...)
         return true;
     });
 }
4

0 回答 0