操作环境
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;
});
}