.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