上传图片报错-Failed to load resource:the server responded with a status of 413(Request Entity Too Large)

  使用.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。

猜你喜欢

转载自www.cnblogs.com/personblog/p/11751020.html