首页 新闻 搜索 专区 学院

netcore接口运行中,接口上报提示An unhandled exception was thrown by the application.

0
悬赏园豆:50 [待解决问题]

程序运行中会莫名的集中出现请求异常情况。
异常信息如下:
Category: Microsoft.AspNetCore.Server.Kestrel
EventId: 13
ConnectionId: 0HM91D69S4HC9
RequestId: 0HM91D69S4HC9:00000001
RequestPath: /api/ZXCameraManage/SpaceStatus
SpanId: |a2d317c4-4150d17115630397.
TraceId: a2d317c4-4150d17115630397
ParentId:

Connection id "0HM91D69S4HC9", Request id "0HM91D69S4HC9:00000001": An unhandled exception was thrown by the application.

Exception:
Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Unexpected end of request content.
at Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException.Throw(RequestRejectionReason reason)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1ContentLengthMessageBody.ReadAsyncInternal(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpRequestStream.ReadAsyncInternal(Memory1 buffer, CancellationToken cancellationToken) at Microsoft.AspNetCore.WebUtilities.FileBufferingReadStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken) at Microsoft.AspNetCore.WebUtilities.StreamHelperExtensions.DrainAsync(Stream stream, ArrayPool1 bytePool, Nullable1 limit, CancellationToken cancellationToken) at Microsoft.AspNetCore.Mvc.Formatters.NewtonsoftJsonInputFormatter.ReadRequestBodyAsync(InputFormatterContext context, Encoding encoding) at Microsoft.AspNetCore.Mvc.ModelBinding.Binders.BodyModelBinder.BindModelAsync(ModelBindingContext bindingContext) at Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder.BindModelAsync(ActionContext actionContext, IModelBinder modelBinder, IValueProvider valueProvider, ParameterDescriptor parameter, ModelMetadata metadata, Object value) at Microsoft.AspNetCore.Mvc.Controllers.ControllerBinderDelegateProvider.<>c__DisplayClass0_0.<<CreateBinderDelegate>g__Bind|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication1 application)

xianz的主页 xianz | 初学一级 | 园豆:152
提问于:2021-05-28 18:00
< >
分享
所有回答(2)
0

这个好像是正常的,客户端主动取消的请求好像就会报这个错

戎"码"一生 | 园豆:864 (小虾三级) | 2021-05-31 14:01

大概查到问题了,程序并发性能不好,请求发生等待了,导致请求主动取消了

支持(0) 反对(0) xianz | 园豆:152 (初学一级) | 2021-05-31 14:52
1

楼主是不是在中间件里面 读取了Request.Body

Mirck | 园豆:124 (初学一级) | 2021-06-01 13:50

现在排查出来是因为业务需要顺序性,所以前同事开发使用了锁,导致并发量不高。在高并发下,导致请求超时,后续请求取消访问。

支持(0) 反对(0) xianz | 园豆:152 (初学一级) | 2021-06-01 17:16
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册