更新时间:2023-02-09 09:35:09
问题已解决:
在网络配置中:
<security>
<requestFiltering>
<!-- This will handle requests up to 300MB -->
<requestLimits maxAllowedContentLength="314572800" />
</requestFiltering>
</security>
和在asp核心3.1 ConfigureServices中: 我不明白原因,但是这段代码解决了问题
and in asp core 3.1 ConfigureServices : I did not understand the reason, but this piece of code solved the problem
services.Configure<FormOptions>(options =>
{
options.ValueLengthLimit = int.MaxValue;
options.MultipartBodyLengthLimit = long.MaxValue; // <-- ! long.MaxValue
options.MultipartBoundaryLengthLimit = int.MaxValue;
options.MultipartHeadersCountLimit = int.MaxValue;
options.MultipartHeadersLengthLimit = int.MaxValue;
});