2017-05-26 129 views
1

当IIS应用程序池回收时,将重建所有ServiceStack SSE连接。如果有很多连接,比如说2000甚至更多,那么服务器端会抛出很多异常。它说连接被远程主机(客户端)关闭。我想知道为什么会发生这种情况。IIS应用程序池回收时的ServiceStack SSE连接

这里是例外的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

唯一的例外是因为ServiceStack用于发布Server Events不再存在这样写到响应流的长期运行的HTTP连接抛出异常。

发生这种情况时ServiceStack logs the error you see above然后自动unsubscribes the Event subscription

+0

只是不明白为什么它会发送“\ n”即使它已过期? – Hong

+0

@Hong可能是在AppHost/ServerEvents处置后尝试将通知发布到订阅的结果。我已将它更改为在[this commit]([提交])(https://github.com/ServiceStack/ServiceStack/commit/2b60599f451021c2d8cab46614e55dc6cb55ed7c)中处理后不再发布给订阅者,此更改可从v4.5.9在MyGet上](http://docs.servicestack.net/myget)。 – mythz

+0

在我的一台服务器上,它总是试图从redis获得大量auth会话。即使我已经重新启动应用程序池或甚至重新启动服务器。我已经检查过,根本没有连接。 – Hong