.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
    });


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM