调用 .Net Core 6.0 Web API 报错:Request body too large. The max request body size is 30000000 bytes.
Startup.cs增加如下内容:
- services.Configure<KestrelServerOptions>(options =>
- {
- options.Limits.MaxRequestBodySize = int.MaxValue;
- });
-
- services.Configure<FormOptions>(options =>
- {
- options.ValueLengthLimit = int.MaxValue;
- options.MultipartBodyLengthLimit = int.MaxValue;
- });