gpt4 book ai didi

c# - 客户端断开连接

转载 作者:太空狗 更新时间:2023-10-29 21:26:23 26 4
gpt4 key购买 nike

我在 WebAPI 的日志中收到以下错误

System.Web.HttpException (0x800703E3): The client disconnected. at System.Web.Hosting.IIS7WorkerRequest.EndRead(IAsyncResult asyncResult) at System.Web.HttpBufferlessInputStream.EndRead(IAsyncResult asyncResult) at System.Threading.Tasks.TaskFactory 1.FromAsyncTrimPromise 1.Complete(TInstance thisRef, Func 3 endMethod, IAsyncResult asyncResult, Boolean requiresSynchronization) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.IO.StreamReader.d__97.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.IO.StreamReader.d__62.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Owin.OwinRequest.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Owin.Security.OAuth.OAuthAuthorizationServerHandler.d__22.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Owin.Security.OAuth.OAuthAuthorizationServerHandler.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware 1.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Web.API.Middleware.OwinMiddleware.d__1.MoveNext() in D:\UAT\Web.API\Middleware\OwinMiddleware.cs:line 49

如何通过异常过滤器处理和忽略这些异常?为什么会出现此错误,我该如何重现该错误?我只想捕获并忽略 The client disconnected 但不是所有 HttpException

我看到了this similar question但我如何在异常过滤器中做到这一点?

最佳答案

您可以忽略这些异常。

异常说明问题是什么:“客户端已断开连接”。这意味着客户端发起了一个请求,但在它懒得阅读所有响应之前就断开了连接。

出现这种情况的原因有很多,但是(除非您的服务器端有不稳定的互联网连接)这几乎肯定是客户端的问题。我自己经常看到这些,而且大多数似乎与机器人有关。所以我过滤掉它们并忽略它们。

关于c# - 客户端断开连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44924378/

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