C# 上传文件过大引起的报错
作者:互联网
操作环境
Asp .Net Core 5.0
错误日志
Failed to read the request form. Request body too large.
解决方法
修改Startup.cs
文件
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
services.Configure<FormOptions>(x =>
{
x.ValueLengthLimit = int.MaxValue;
x.MultipartBodyLengthLimit = int.MaxValue;
x.MemoryBufferThreshold = int.MaxValue;
});
services.Configure<KestrelServerOptions>(options =>
{
options.Limits.MaxRequestBodySize = 1024 * 1024 * 1024;
});
}
标签:1024,Configure,C#,MaxValue,int,报错,services,上传,options 来源: https://www.cnblogs.com/linyisonger/p/15456964.html