gpt4 book ai didi

asp.net-web-api - 来自 System.Web.Http.HostAuthenticationFilter 的 OperationCanceledException

转载 作者:行者123 更新时间:2023-12-03 23:54:12 25 4
gpt4 key购买 nike

我们最近检查了我们的错误日志,看到了很多“操作被取消”的异常。
我们无法重现它们,看起来像是中止的请求,但它们都来自 OWIN HostAuthenticationFilter。

这是堆栈跟踪:

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()

有没有人见过这个错误?

最佳答案

我知道这个问题已经有一年多了,但我把它留在这里以防其他人和我有同样的问题。

是的,这是由取消请求引起的,可能有多种原因,但就我而言,我怀疑您的情况也是如此。 这是由客户端在服务器响应之前关闭请求连接引起的。 因此服务器取消不再需要的线程来释放它并抛出异常 System.OperationCanceledException .

在此 StackOverflow 问题后半年创建的 IdentityServer 的 GitHub 上查看此问题:https://github.com/IdentityServer/IdentityServer3/issues/1698

Yea, sounds like the user-agent closed its HTTP connection before the server had a chance to finish replying. - source



有关从记录中捕获这些异常的方法,请参阅此类似的 StackOverflow 问题 ASP.NET Web API OperationCanceledException when browser cancels the request .

关于asp.net-web-api - 来自 System.Web.Http.HostAuthenticationFilter 的 OperationCanceledException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27140449/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com