当IIS应用程序池回收时,将重建所有ServiceStack SSE连接。如果有很多连接,比如说2000甚至更多,那么服务器端会抛出很多异常。 它表示连接由远程主机(客户端)关闭。我想知道为什么会这样。
以下是servicestack日志中的异常示例
2017-05-24 15:22:12,131: ERROR 14 EventSubscription - Error publishing notification to:
System.Web.HttpException (0x800704CD): The remote host closed the connection. The error code is 0x800704CD.
at System.Web.Hosting.IIS7WorkerRequest.RaiseCommunicationError(Int32 result, Boolean throwOnDisconnect)
at System.Web.Hosting.IIS7WorkerRequest.ExplicitFlush()
at System.Web.HttpResponse.Flush(Boolean finalFlush, Boolean async)
at System.Web.HttpResponse.Flush()
at System.Web.HttpWriter.WriteFromStream(Byte[] data, Int32 offset, Int32 size)
at System.Web.HttpResponseStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at ServiceStack.StreamExt.Write(Stream stream, String text)
at ServiceStack.ServerEventsFeature.<>c.<.ctor>b__76_0(IResponse res, String frame)
at ServiceStack.EventSubscription.PublishRaw(String frame)
答案 0 :(得分:0)
异常是因为ServiceStack用于发布Server Events的长时间运行的HTTP连接不再存在,因此写入响应流会抛出该异常。
当发生这种情况时ServiceStack logs the error you see above然后自动unsubscribes the Event subscription。