环境:Windows, Linux发布.net 6 API 发起接口请求报错:Request body too large. The max request body size is 30000000 bytes. 解决方式,Startup.cs添加如下代码:
1 2 3 4 5 |
//接口请求限制 services.Configure<KestrelServerOptions>(options => { options.Limits.MaxRequestBodySize = int.MaxValue; }); |
下面是github的issue,基本上可以解决大部分请求遇到的大小限制问题,可根据自己需要添加相关代码: https://github.com/dotnet/aspnetcore/issues/20369 from:https://blog.csdn.net/The_Moon_/article/details/127996098
View Details