I am running an AppHostHttpListenerSmartPoolBase server. It generally works properly except sometimes when I get the following error:
Exception type: ‘HttpListenerException’
Message: An operation was attempted on a nonexistent network connection
Trace: in System.Net.HttpResponseStream.Write(Byte buffer, Int32 offset, Int32 size)
in ServiceStack.Text.DefaultMemory.Write(Stream stream, ReadOnlyMemory`1 value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\DefaultMemory.cs:riga 432
in ServiceStack.ServerEventsFeature.<>c.<.ctor>b__118_0(IResponse res, String frame) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\ServerEventsFeature.cs:riga 104
in ServiceStack.EventSubscription.PublishRaw(String frame) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\ServerEventsFeature.cs:riga 770
Logging some more information I can say that the exact error code returned inside the exception has value 1229. It seems to happen randomically.
After this exception is fired the connection with client goes down and then goes up again but I would to find a way to avoid throwing the exception at all.
Can someone explain how to prevent the exception to be thrown?
Thank you in advance,