gpt4 book ai didi

asp.net - maxAllowedContentLength 不适用于 IHttpHandler IIS7

转载 作者:行者123 更新时间:2023-12-01 01:22:22 27 4
gpt4 key购买 nike

我有处理文件上传的 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 = 51200 KiB 在 50 MiB

关于asp.net - maxAllowedContentLength 不适用于 IHttpHandler IIS7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8354112/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com