首页 > Web开发 > 详细

.net Core 解决Form value count limit 1024 exceeded. (文件上传过大)

时间:2019-05-22 23:19:26      阅读:393      评论:0      收藏:0      [点我收藏+]
原文:.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
    });

.net Core 解决Form value count limit 1024 exceeded. (文件上传过大)

原文:https://www.cnblogs.com/lonelyxmas/p/10909100.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!