Request body too large. The max request body size is 30000000 bytes.

环境:Windows, Linux发布.net 6 API

Request body too large. The max request body size is 30000000 bytes._第1张图片

发起接口请求报错:Request body too large. The max request body size is 30000000 bytes.

解决方式,Startup.cs添加如下代码:

            //接口请求限制
            services.Configure(options =>
            {
                options.Limits.MaxRequestBodySize = int.MaxValue;
            });

下面是github的issue,基本上可以解决大部分请求遇到的大小限制问题,可根据自己需要添加相关代码:

https://github.com/dotnet/aspnetcore/issues/20369

你可能感兴趣的:(异常集合,c#,.netcore)