问题描述

在使用App Service (Windows)做文件/图片上传时候,时常遇见上传大文件时候出现错误,这是因为IIS对文件的大小由默认限制。当遇见(Maximum request length exceeded)错误时,需要对通过web.config来修改请求体的大小。

 

在应用的发布文件中,如果包含了web.config文件,则可以自己在文件中修改后重新发布。也可以直接登录kudu站点(两种方式登录Kudu。一:Azure App Service Overview -> Advanced Tools -> Go。 二:在站点URL加上SCM访问。如:https://xxxxxx.scm.chinacloudsites.cn/)在wwwroot目录下修改web.config文件。 

web.config的文件内容如下:

<system.webServer>
 <system.web>       
    <httpRuntime maxRequestLength="1048576" />  
    </system.web>

   <security>
      <requestFiltering>
         <requestLimits maxAllowedContentLength="1073741824" />
      </requestFiltering>
   </security>
 </system.webServer>

 

参考文档

JAVA 网站上传大文件报 500 错误https://docs.azure.cn/zh-cn/articles/azure-operations-guide/app-service-web/aog-web-apps-qa-java-upload-large-file-error

 

版权声明:本文为lulight原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/lulight/p/13880926.html