Description
This may be similar to this issue, but I'm not certain it's the same #420
We are seeing an ObjectDisposedException during long-running requests. Our service calls into a number of external services, and there are small number of those external requests that may time out occasionally. Sometimes, we see ObjectDisposedException thrown during that scenario. We are wondering if there is any suggested way to handle this type of scenario. Is there a way to ensure that the HttpListenerObject is not disposed while the request is still active? Should we just catch the exception and check for certain conditions which may imply a downstream request has timed out, and handle it more gracefully?
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.HttpListenerResponse'.
at System.Net.HttpListenerResponse.CheckDisposed()
at System.Net.HttpListenerResponse.set_ContentLength64(Int64 value)
at Microsoft.Owin.Host.HttpListener.RequestProcessing.HeadersDictionaryBase.Set(String key, String[] value)
at System.Web.Http.Owin.HttpMessageHandlerAdapter.SendResponseMessageAsync(HttpRequestMessage request, HttpResponseMessage response, IOwinResponse owinResponse, CancellationToken cancellationToken)
at System.Web.Http.Owin.HttpMessageHandlerAdapter.d__0.MoveNext()