api上传图片 超过了最大请求长度

尝试将IIS设置为接受2GB请求(以字节为单位).

 

 

<system.webServer>
  <security>
    <requestFiltering>
      <requestLimits maxAllowedContentLength="2147483648" /> // 2GB
    </requestFiltering>
  </security>
</system.webServer>

并为ASP.NET应用程序设置合理的请求大小(以千字节为单位).

 

<system.web>
  <httpRuntime maxRequestLength="4096" /> // 4MB (default)
</system.web>

现在IIS应该允许小于2GB的请求传递给您的应用程序,但应用程序将跳转到Application_Error达到4MB请求大小.在那里,您可以管理您想要返回的内容.

无论如何,大于2GB的请求将始终由IIS返回404.13.

 

注意:maxRequestLength与maxAllowedContentLength的区别

1、前者表示请求长度,后者表示上传文件的大小;

2、前者单位kb,后者单位字节;

3、前者默认值4M,后者默认值30000000B,约30M;

4、两者的最大值都为2G

 

<httpRuntime maxRequestLength="20480" executionTimeout="60"/>

 

http://www.voidcn.com/article/p-dklfjjpk-buk.html

https://blog.csdn.net/weixin_44549313/article/details/96424115

posted @ 2021-09-13 21:51  BloggerSb  阅读(264)  评论(0编辑  收藏  举报