gpt4 book ai didi

asp.net - IIS7-请求过滤模块配置为拒绝超过请求内容长度的请求

转载 作者:行者123 更新时间:2023-12-03 05:42:59 31 4
gpt4 key购买 nike

我想上传图像,它在我的机器上运行良好,但是当我将网站放在 IIS7 公共(public)服务器上时,我无法上传任何内容。

错误

The request filtering module is configured to deny a request that exceeds the request content length.

最可能的原因

Request filtering is configured on the Web server to deny the request because the content length exceeds the configured value.

你可以尝试的事情

Verify the configuration/system.webServer/security/requestFiltering/requestLimits@maxAllowedContentLength setting in the applicationhost.config or web.config file.

Web.config 中的 system.webServer

  <system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1048576" />
</requestFiltering>
</security>
</system.webServer>

如您所见,我将 maxAllowedContentLength 设置为 1gb。重新启动我的网站,仍然出现此错误。我在我的文件系统上创建了一个 /uploads/ 文件夹。不知道是什么原因导致此错误以及为什么我无法上传图像。

最佳答案

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

来自here .

对于 IIS7 及更高版本,您还需要添加以下行:

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

关于asp.net - IIS7-请求过滤模块配置为拒绝超过请求内容长度的请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10871881/

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