繁体   English   中英

maxAllowedContentLength 不适用于 IHttpHandler IIS7

[英]maxAllowedContentLength do not work for IHttpHandler IIS7

我有 ASP.NET IHttpHandler 模块来处理文件上传。 我在配置文件中将文件大小限制设置为 50mb

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

但在上传 13mb 文件时仍然出错。

System.Web.HttpException (0x80004005): Maximum request length exceeded.

如何增加默认允许的文件大小?

总而言之,要在IIS7中将文件上载大小提高到50 MiB,请在Web.config文件的正确部分中添加以下行:

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

  <system.web>
    <httpRuntime maxRequestLength="51200" />
  </system.web>

1024 X 1024 X 50 = 50 MiB中的5242880字节

1024 X 50 = 512 MiB,50 MiB

在web应用程序的web.config下使用以下内容

<httpRuntime maxRequestLength="52428800" />

对于经典 ASP 用户,除了 web.config 设置外,还要检查此设置:

IIS >点击网站> ASP >限制属性>最大请求实体主体限制

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM