.net Core 解决Form value count limit 1024 exceeded. (文件上传过大)
异常清空如图
原因:.net core提交的表单限制太小导致页面表单提交失败
在控制器上使用 RequestFormLimits attribute
[RequestFormLimits(ValueCountLimit = 5000)]
public class TestController: Controller
在Startup.cs设置RequestFormLimits
public void ConfigureServices(IServiceCollection services)
{
services.Configure<FormOptions>(options =>
{
options.ValueCountLimit = 5000; // 5000 items max
options.ValueLengthLimit = 1024 * 1024 * 100; // 100MB max len form data
});