I've a C# ASP.NET Core MVC website. I'm running it in Visual Studio. I'm posting to a controller action that takes parameter string[] identifiers. The HTML form element is a textarea that has values like:
one
two
three
This works fine, and identifiers
is properly populated with 3 entries.
If the textarea instead has 37,000+ lines (1.4 MB when saved to disk as a text file), then the controller sees identifiers
as NULL.
In my Startup.cs
I've used (and have also used with just the defaults):
services.Configure<IISServerOptions>(o =>
{
o.MaxRequestBodySize = int.MaxValue;
});
services.Configure<KestrelServerOptions>(o =>
{
o.Limits.MaxRequestBodySize = int.MaxValue;
});
services.Configure<FormOptions>(o =>
{
o.ValueLengthLimit = int.MaxValue;
o.MultipartBodyLengthLimit = int.MaxValue;
});
And my web.config
(I'm running this from Visual Studio, and web.config
is set to "Copy Always") contains:
<configuration>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
</configuration>
There are no errors or warnings in the Windows Event Viewer, so I suspect it's an issue in code?
Assuming the issue is related to max POST size, where have I gone wrong?
Update The data is posted with jQuery ajax, with no contentType specified. I think the default is: 'application/x-www-form-urlencoded; charset=UTF-8' which likely limits the request to 2k. Though explicitly setting a contentType doesn't seem to help.