'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.
Solution 1:[1]
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:
Solution 2:[2]
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;
});
Solution 3:[3]
It's possible that your Execution Timeout is short coz aside from maximum lenght you also need to take note that web page only execute on maximum seconds of time.. in php it is 60 seconds. For asp.net you can modify the web.config add this on httpRunTime
<httpRuntime executionTimeout="300"
where 300 is equivalent to 5 minutes or 300 / 60.
I hope this resolve your issue and happy coding! =)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | ChadT |
Solution 2 | amin89 |
Solution 3 | Fernan Vecina |