I am facing the below exception on my service and this happens very often, say once a hour or so.
Anyone faced something similar and know of a solution to get rid of this?
AFAIK, there is no issue with any of my service code, I am guessing it is some bug on OWIN which might need fix or already have fix which I am not aware of.
Below are the list of Nuget packages used
Microsoft.AspNet.WebApi.OwinSelfHost 5.2.2
Microsoft.Owin.Host.HttpListener 3.0.1
Microsoft.Owin.Hosting 3.0.1
String1="Unhandled exception caught in catch-block "HttpMessageHandlerAdapter.BufferContent" from controller "<unknown controller>".
Exception = System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown... at System.IO.MemoryStream.set_Capacity(Int32 value)..
at System.IO.MemoryStream.EnsureCapacity(Int32 value).. at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)..
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder).. at System.IO.StreamWriter.Write(String value)..
at Newtonsoft.Json.Utilities.JavaScriptUtils.WriteEscapedJavaScriptString(TextWriter writer, String s, Char delimiter, Boolean appendDelimiters, Boolean[] charEscapeFlags, StringEscapeHandling stringEscapeHandling, IArrayPool`1 bufferPool, Char[]& writeBuffer)..
at Newtonsoft.Json.JsonTextWriter.WriteEscapedString(String value, Boolean quote).. at Newtonsoft.Json.JsonWriter.WriteValue(JsonWriter writer, PrimitiveTypeCode typeCode, Object value)..
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)..
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)..
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty).. at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)..
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType).. at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding).. at System.Net.Http.Formatting.JsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding)..
at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)..--- End of stack trace from previous location where exception was thrown ---.. at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()..
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task).. at System.Web.Http.Owin.HttpMessageHandlerAdapter.<BufferResponseContentAsync>d__13.MoveNext()"