.NET Core 6.0 出现BadHttpRequestException异常 Unexpected end of request content
不知道大神有没有遇到过,在请求对方post过来的数据时,出现这个异常
详细堆栈如下:
Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Unexpected end of request content.
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1ContentLengthMessageBody.ReadAsyncInternal(CancellationToken cancellationToken)
at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder1.StateMachineBox
1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpRequestStream.ReadAsyncInternal(Memory`1 destination, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpRequestStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.StreamReader.ReadBuffer()
at System.IO.StreamReader.ReadToEnd()
at Agoda.Order.WebApi.Controllers.AgodaController.GetRequestBodyAsyncTRequest in E:\svn\XiWan.OTA\Agoda.Order\src\Agoda.Order.WebApi\Controllers\AgodaController.cs:line 185
at Agoda.Order.WebApi.Controllers.AgodaController.HotelSearch() in E:\svn\XiWan.OTA\Agoda.Order\src\Agoda.Order.WebApi\Controllers\AgodaController.cs:line 113
回答
这是正常的异常,可以忽略