IIS7 - 请求过滤模块配置为拒绝超过请求内容长度的请求 [英] IIS7 - The request filtering module is configured to deny a request that exceeds the request content length

查看:39
本文介绍了IIS7 - 请求过滤模块配置为拒绝超过请求内容长度的请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想上传图片,它在我的机器上运行良好,但是当我将我的网站放在 IIS7 服务器上供公众使用时,我无法上传任何内容.

错误

<块引用>

请求过滤模块被配置为拒绝一个请求超过请求内容长度.

最可能的原因

<块引用>

在Web服务器上配置请求过滤来拒绝请求因为内容长度超过了配置值.

可以尝试的东西

<块引用>

验证配置/system.webServer/security/requestFiltering/requestLimits@maxAllowedContentLength在 applicationhost.config 或 web.config 文件中设置.

Web.config 中的 system.webServer

 <validation validateIntegratedModeConfiguration="false"/><modules runAllManagedModulesForAllRequests="true"/><安全><请求过滤><requestLimits maxAllowedContentLength="1048576"/></requestFiltering></安全></system.webServer>

如您所见,我将 maxAllowedContentLength 设置为 1gb.重新启动我的网站,仍然收到此错误.我在我的文件系统上创建了一个 /uploads/ 文件夹,它也应该在那里.不知道是什么导致了这个错误以及为什么我无法上传图片.

解决方案

<system.web><httpRuntime maxRequestLength="1048576"/></system.web></配置>

来自这里.

对于 IIS7 及以上,还需要添加以下几行:

 <安全><请求过滤><requestLimits maxAllowedContentLength="1073741824"/></requestFiltering></安全></system.webServer>

I want to upload images, it works fine on my machine but when I put my website on IIS7 server for public I can't upload anything.

Error

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

Most likely causes

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

Things you can try

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

system.webServer in Web.config

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

As you can see I set my maxAllowedContentLength to 1gb. Restarted my website and still getting this error. I made an /uploads/ folder on my file system where it suppose to be as well. Have no idea what causes this error and why I can't upload images.

解决方案

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

From here.

For IIS7 and above, you also need to add the lines below:

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

这篇关于IIS7 - 请求过滤模块配置为拒绝超过请求内容长度的请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆