Tag Archives: C# upload Large File Error

How to Solve C# upload Large File Error

Operating Environment
Asp .Net Core 5.0
Error Log

Failed to read the request form. Request body too large.

Solution:

Modify Startup.csfile

public void ConfigureServices(IServiceCollection services)
{

	services.AddControllers();

	services.Configure<FormOptions>(x =>
	{
		x.MultipartBodyLengthLimit =  1024 * 1024 * 1024;
		x.ValueLengthLimit = int.MaxValue;
	});
	services.Configure<KestrelServerOptions>(options =>
	{
		options.Limits.MaxRequestBodySize = 1024 * 1024 * 1024;
	});
}