-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Description
Describe the bug
I have a very simple ASP.NET 5 (Core) MVC app with this action method:
[HttpPost]
public IActionResult Send(string message, string secret)
{
// ...
}
This method is called by external API that is POST'ing very(!) large data in the "message
" form field. Like, 35-megabytes big.
This results in all parameters being "null
". Silently. No exception is thrown. No log entry. Just have the "null
" and good luck investigating ¯\_(ツ)_/¯
Smaller data works fine
THE FIX
This is obviously because of the size. Adding this attribute fixes the issue:
[RequestFormLimits(ValueLengthLimit = 50000000, MultipartBodyLengthLimit = 50000000)] //the fix
[HttpPost]
public IActionResult Send(string message, string secret)
{
// ...
}
I'm not the only one with this problem: https://stackoverflow.com/questions/61295714/asp-net-core-3-1-argument-model-always-null-with-large-form-data-in-controller
Proposal
It would be nice if some kind of exception was thrown, so we know something's wrong. Like the "classic" ASP.NET always did - with the "request length" exception.
Further technical details
- ASP.NET Core version 5.0.5