I want to know what is default maximum request length in a .net core application.
I read from few links that the default limit is 4 MB for asp.net applications and same should apply here.
But on testing i found that even without overriding the default limit i am able to upload files of size around 14 MB but it fails for files of size around 30 MB.
I certainly know how to increase this limit but i want to know what is the default limit. Is there any c# code to check? Could not find any related documentation regarding this.
2,147,483,647 bytes, since the value is a signed integer (Int32).
Large file uploads in ASP.NET The default maximum filesize is 4MB - this is done to prevent denial of service attacks in which an attacker submitted one or more huge files which overwhelmed server resources. If a user uploads a file larger than 4MB, they'll get an error message: "Maximum request length exceeded."
ASP.NET Core – Exceeds 1.15 Million request/s, 12.6 Gbps NET Core teams and the Open Source . NET community for quite a milestone in performance!
As of ASP.NET Core 6, the default maximum request body size is 30,000,000 bytes, which is approximately 28.6 MB. These are the same defaults if you are running against IIS or Kestrel.
Sources:
ASP.NET Core docs - Kestrel
ASP.NET Core docs - IIS
The default maximum filesize is 4MB.
If you want to increase the upload size, you can do it like this:
Using application wise settings - in the configure services method. In this example, upload up to 100 MB file.
services.Configure<FormOptions>(options =>
{
options.MultipartBodyLengthLimit = 100000000;
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With