Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The client disconnected

I'm getting the following error in logs for 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

How can I handle and ignore these exceptions by exception filter? Why this error occurs and how can I reproduce that? I wanna catch and ignore only The client disconnected but not all HttpException

I saw this similar question but how can I do that in exception filter?

like image 703
Pr.Dumbledor Avatar asked Jul 05 '17 10:07

Pr.Dumbledor


1 Answers

You can ignore these exceptions.

The exception says what the problem is: "The client disconnected". It means that the client initiated a request but then disconnected before it bothered to read all of the response.

There are any numbers of reasons why that might be the case, but (unless you have a dodgy internet connection at your server end) it is almost certainly an issue at the client end. I regularly see these myself and mostly it seems to be related to a bot. So I filter them out and ignore them.

like image 182
Brian Cryer Avatar answered Sep 28 '22 03:09

Brian Cryer