2014-11-26 22 views
9

Recentemente abbiamo controllato i nostri log degli errori e abbiamo visto molte eccezioni "L'operazione è stata annullata". Non siamo stati in grado di riprodurli, sembra una richiesta interrotta, ma provengono tutti da OWIN HostAuthenticationFilter.OperationCanceledException da System.Web.Http.HostAuthenticationFilter

Ecco la traccia dello stack:

System.OperationCanceledException: The operation was canceled. 
    at System.Threading.CancellationToken.ThrowOperationCanceledException() 
    at System.Web.Http.HostAuthenticationFilter.<AuthenticateAsync>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.ThrowForNonSuccess(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
    at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__24.MoveNext() 
--- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
    at System.Web.Http.Controllers.AuthenticationFilterResult.<ExecuteAsync>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.ThrowForNonSuccess(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
    at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() 
    at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext() 

qualcuno ha visto che l'errore prima?

risposta

1

So che questa domanda ha più di un anno, ma la lascio qui nel caso in cui qualcun altro avesse la stessa domanda di me.

Sì, questo è causato da una richiesta di annullamento e potrebbe essere per una serie di motivi, ma nel mio caso e ciò che sospetto sia il tuo caso pure. È stato causato dal client quando ha chiuso la connessione della richiesta prima che il server potesse rispondere. Così il server annulla il thread non più necessario per liberarlo e lancia l'eccezione, System.OperationCanceledException.

Dai un'occhiata a questo problema su GitHub per IdentityServer che è stato creato un anno e mezzo dopo questa domanda StackOverflow: https://github.com/IdentityServer/IdentityServer3/issues/1698

Sì, suona come l'user-agent chiuso la sua connessione HTTP prima che il server ha avuto la possibilità di finire rispondere. - source

Vai a questa domanda StackOverflow simili modi per catturare queste eccezioni vengano registrati ASP.NET Web API OperationCanceledException when browser cancels the request.