How to increase request length to upload large files in .NET Core 6?
I have developed an ASP.NET Core Web API which is used to upload files. I am testing the API through postman. When I try to upload a file whose size is more than 28 MB it throws a request length exceeded error.
How to increase request length globally for IIS express and Dotnet CLI?
Answers (1)Add Answer
After a lot of research, I found this and it works for me.
options.MaxRequestBodySize = int.MaxValue;
options.Limits.MaxRequestBodySize = int.MaxValue;
just add these pieces of code in your Program.cs