ASP.NET Core MVC 2
I need to send big raw data (the byte[]
). My POST
-request contains the Content-Type: application/octet-stream
header.
This is the controller action:
[HttpPost]
public async Task<IActionResult> RawBinaryDataManual()
{
using (var ms = new MemoryStream())
{
await Request.Body.CopyToAsync(ms);
var bytes = ms.ToArray();
return StatusCode((int) HttpStatusCode.OK);
}
}
It works fine when I post 22Mb file, but I get the Exception thrown: 'Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException'
error if I try to send the 38Mb file.
How can I fix this problem?
UPD
Thanks to phuzi - he wrote the link in the comments which helped to me to solve my problem.