-
Notifications
You must be signed in to change notification settings - Fork 336
Description
Looks like OwinHttpListenerContext subscribes itself on cancellationToken that is used to notify other layers and in parallel to user’s request handling does
OwinHttpListenerContext.End()
OwinHttpListenerResponse.End()
HttpListenerResponse.Close()
or
HttpListenerResponse.Abort()
too early, that leads to ObjectDiposedException to be thrown in Web.API stack:
[LogAsync,UnhandledExceptionLogger.cs(20) ] Exception handling request http://something.com/
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.HttpListenerRequest'.
at System.Net.HttpListenerRequest.CheckDisposed()
at System.Net.HttpListenerRequest.get_LocalEndPoint()
at System.Net.HttpListenerRequest.get_IsLocal()
at Microsoft.Owin.Host.HttpListener.RequestProcessing.OwinHttpListenerContext.GetServerIsLocal()
at Microsoft.Owin.Host.HttpListener.RequestProcessing.CallEnvironment.get_ServerIsLocal()
at Microsoft.Owin.Host.HttpListener.RequestProcessing.CallEnvironment.PropertiesTryGetValue(String key, Object& value)
at Microsoft.Owin.Host.HttpListener.RequestProcessing.CallEnvironment.TryGetValue(String key, Object& value)
at Microsoft.Owin.OwinContext.Get[T](String key)
at System.Web.Http.Owin.OwinHttpRequestContext.get_IsLocal()
at System.Web.Http.Owin.OwinHttpRequestContext.get_IncludeErrorDetail()
at System.Net.Http.HttpRequestMessageExtensions.CreateErrorResponse(HttpRequestMessage request, HttpStatusCode statusCode, Func`2 errorCreator)
at System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Web.Http.Cors.CorsMessageHandler.d__0.MoveNext()
--- 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.PassiveAuthenticationMessageHandler.d__0.MoveNext()
--- 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.HttpServer.d__0.MoveNext()