使用.netcore2.1 做文件上传时,要求是小于20M,上传3至5M都没问题,大于10M,提示错误【如标题】,原来是nginx配置的原因
[HttpPost("Postcard")]
[RequestSizeLimit(20000000)] //文件最大为20M
public async Task<WebApiResult> PostCard(CardType cardType, string userName)
{ }
解决方法:
打开nginx反向代理服务器nginx.conf配置文件,修改client_max_body_size值,client_max_body_size 20M。