Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is default maximum request length in .net core

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.

like image 567
Satyajit Avatar asked Jul 12 '17 07:07

Satyajit


People also ask

What is Max request length?

2,147,483,647 bytes, since the value is a signed integer (Int32).

What is Maximum request length exceeded?

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."

How many requests per second can ASP.NET Core handle?

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!


2 Answers

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

like image 154
a-ctor Avatar answered Sep 26 '22 01:09

a-ctor


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;
});
like image 22
amin89 Avatar answered Sep 25 '22 01:09

amin89