我有以下设置:在 AWS 应用程序负载均衡器后面,运行着几个 Linux 容器上的 Web API(构建于 aspnetcore 2.0.5)。
客户端使用 HttpClient 向此 API 发出请求。该客户端在多个并行任务中运行调用。如果并行任务数量增加,则 API 开始抛出带有“请求超时”的异常消息。
调用栈如下:
at Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines.PipeCompletion.ThrowFailed() at Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines.Pipe.GetResult(ReadResult& result) at Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines.Pipe.Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines.IReadableBufferAwaiter.GetResult() at Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines.ReadableBufferAwaitable.GetResult() at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.MessageBody.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.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Frame`1.d__2.MoveNext()
是什么原因导致了这个错误?是谁设置了超时时间,我应该如何进一步调查?
编辑:如果我尝试使用 Fiddler 捕获失败的请求,就不会再抛出错误了(可能是因为 Fiddler 以较低的并行度打开连接)。
客户端使用 HttpClient 向此 API 发出请求。该客户端在多个并行任务中运行调用。如果并行任务数量增加,则 API 开始抛出带有“请求超时”的异常消息。
调用栈如下:
at Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines.PipeCompletion.ThrowFailed() at Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines.Pipe.GetResult(ReadResult& result) at Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines.Pipe.Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines.IReadableBufferAwaiter.GetResult() at Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines.ReadableBufferAwaitable.GetResult() at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.MessageBody.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.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Frame`1.d__2.MoveNext()
是什么原因导致了这个错误?是谁设置了超时时间,我应该如何进一步调查?
编辑:如果我尝试使用 Fiddler 捕获失败的请求,就不会再抛出错误了(可能是因为 Fiddler 以较低的并行度打开连接)。
httpClient.TimeOut
吗?此外,您是否在特定的端点或所有类型的请求中都遇到了这个问题? - Setint.MaxValue
)。 - McGuireV10