HTTP Error 404.13 - Not Found The request filtering module is configured to deny a request that exceeds the request content length.
Verify the configuration/system.webServer/security/requestFiltering/requestLimits@maxAllowedContentLength setting in the applicationhost.config or web.config file.
I've no idea to where can i config that, in asp.net core 2 there has change to use appsettings.json instead.
Even try to do this already, but it's not work.
services.Configure<FormOptions>(options =>
{
options.MultipartBodyLengthLimit = 300_000_000;
});
The default value of 30000000 Bytes for the content length, which was not sufficient for me in some of the file uploading functionalities.
If you use IIS, you need add web.config in your asp.net core 2.0 app.
If you are not using IIS you can use
[RequestSizeLimit(long.MaxValue)]
or[DisableRequestSizeLimit]
attribute in your controller.Also, you can add a global setting in Program.cs:
For more info see this https://github.com/aspnet/Announcements/issues/267
For my Core 2.2 MVC project, combining the [RequestSizeLimit(long.MaxValue)] attribute and the web.config above did not work. The web.config alone worked - Just don't use the attribute. The application crashed and closed the browser unexpectedly. Also, because my max request size is 200Mb, if it's possible to generate a 404.13 (req. too large) result, then your normal status code handling will not work for the 404.13 (see Startup.cs, Configure(), the
line). The status code pages handling works for other codes though. I had to insert custom error status handling into the web.config file to handle 404.13 with a graceful user friendly view. Note that the 'remove' for the 404.13 also appears to remove status code 404 ... and then your Error controller method will not handle a 404. There are two custom error handlers in the web.config below - One for the 404.13 and one for the 404 in order to fix this. Hope this helps someone:
The end result is that all normal status codes are handled by Error/Error, and the 404.13 and 404 status codes have custom handling ... and nice views all around!