• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
导航菜单
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • windows
  • 服务器硬件
  • 服务器运维
  • 云计算
  • 虚拟化
  • IIS教程
  • Linux
  • Apache
  • Ftp
  • DNS
  • Nginx
您的位置:首页 > 服务器 >windows > IIS7文件上传的最大大小设置

IIS7文件上传的最大大小设置

作者:网友 字体:[增加 减小] 来源:互联网

本文主要包含iis7上传文件大小限制,iis7文件上传限制,iis7 配置文件,win7 iis7安装包,iis7是什么等服务器相关知识,网友希望可以进行参考

我们知道在iis7中设置上传文件大小我们只需要修改两个参数:maxRequestLength和maxAllowedContentLength即可了,下面来参考。

当上传一个超过30M的文件时,服务器会重定向至404.13页面,报错如下:

HTTP Error 404.13 - Not Found
The request filtering module is configured to deny a request that exceeds the request content length.
这是由于服务器限制了所能上传文件的最大值。其值在

configuration/system.webServer/security/requestFiltering/requestLimits@maxAllowedContentLength setting

in the applicationhost.config or web.config file. 中定义。

查看C:WindowsSystem32inetsrvconfig目录下的applicationhost.config,可以在

system.webServer/security/requestFiltering/中找到requestLimits设置项,若没有,则可以自行添加如下:(这

里maxAllowedContentLength的单位为bytes。)

 代码如下 复制代码

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

也可以使用命令行模式修改applicationhost.config为:

 代码如下 复制代码

%windir%system32inetsrvappcmd set config -section:requestFiltering -

requestLimits.maxAllowedContentLength:40000000

经过这个设置后,服务器对上传文件的大小限制将变为40000000bytes了。当然,这个设置是服务器级别的,如果你想

在某个站点或者某个应用上限制大小,也可以通过以相同方式进行设置,只不过这次设置的是站点内的Web.config。

但是你要进行此项修改,要确保applicationhost.config中对该项修改的权限已经放开。可通过如下设置进行更改:

 代码如下 复制代码

modify the overrideModeDefault from "Deny" to "Allow" like so:

<sectionGroup name="system.webServer">
     <section name="requestFiltering" overrideModeDefault="Allow" />
</sectionGroup>

确认修改过applicationhost.config中上述设置以后,再进行如下设置。

找到应用的Web.config,按上述进行修改:

 代码如下 复制代码

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

或者你也可以通过命令行的形式:

 代码如下 复制代码

%windir%system32inetsrvappcmd set config "Default Web Site/<your app>" -section:requestFiltering -

requestLimits.maxAllowedContentLength:40000000

这样,你就能针对某个站点的某个应用进行设置。

 

但是开发人员是在Web.Config中进行了如下设置:

 代码如下 复制代码

<system.web>

<httpRuntime maxRequestLength="40960" appRequestQueueLimit="100" useFullyQualifiedRedirectUrl="true"

executionTimeout="120" />

</system.web>

这里的maxRequestLength据MSDN介绍:Gets or sets the maximum request size. The maximum request size in

kilobytes. The default size is 4096 KB (4 MB).

The MaxRequestLength property specifies the limit for the buffering threshold of the input stream. For

example, this limit can be used to prevent denial of service attacks(拒绝服务攻击) that are caused by

users who post large files to the server.

The value assigned to this property should be greater or equal to value assigned to the

RequestLengthDiskThreshold property.

但是开发人员的这个设置好像是不起作用的。他们在这里,限制最大请求长度为40MB,超时为120s。

下次再看一下具体这个设置是用来做什么的。

-------------------------

现在明白了。这个是用来设置单个请求的最大长度。比如EmailTicket中若设置maxRequestLength为30M,

maxAllowedContentLength为40M,

然后在Reply Email时,选择了一个35M的附件,在点击Save as Draft的时候,这个请求的长度大概会有35M,这个已

经超过了maxRequestLength。此时请求就会报错了,结果是黄页:

Server Error in '/emailticket' Application.

--------------------------------------------------------------------------------

Maximum request length exceeded.
Description: An unhandled exception occurred during the execution of the current web request. Please

review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Maximum request length exceeded.

另一种解决办法

在Win2008里,打开IIS7,找到需要修改限制的网站,双击右侧“管理”下面的“配置编辑器”,在上面的“节”处,

找到“system.webServer-->webdav-->asp”,这时,“节”处显示“system.webServer/asp”。

在下面,找到“Limits”,点击左边的加号,改变“bufferingLimit”和“maxRequestAntityAllowed”的值为

“2000000000”(2G,最大值就是2G),改好后回车,点击右边栏顶部“操作”下面的“

分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • IIS7文件上传的最大大小设置
  • Windows中IIS7 大文件上传限制解决办法

相关文章

  • 在CentOS 5上配置NFS服务器
  • 即时通讯开发平台AnyChat 的性能优势
  • windows2003 定时重启服务器方法
  • 了解64位Office 2010 它的优越性是什么
  • WampServer的www目录更改为指定目录
  • Windows不能在本地计算机启动iis admin service
  • IIS中php sendmail函数无法发送邮件
  • Windows多重启动的五个文件和注意事项
  • 自己搭建家庭“云”(1)——概念、布局、平台选择
  • iis“Microsoft JET Database Engine(0x80004005)未指定错误”

文章分类

  • windows
  • 服务器硬件
  • 服务器运维
  • 云计算
  • 虚拟化
  • IIS教程
  • Linux
  • Apache
  • Ftp
  • DNS
  • Nginx

最近更新的内容

    • Windows Server 2003 安装fastcgi图文详解
    • iis 配置伪静态图文教程
    • 网页内容显示不完整的解决方法
    • windows 2008 提示“考虑更改密码”的解决办法
    • 如何成功清理重建CloudStack环境
    • Web网站服务器DDOS攻击的解决方案
    • windows环境配置apache+php+mysql开发环境
    • 自己搭建家庭“云”(1)——概念、布局、平台选择
    • 用来安装 Microsoft Windows 的产品密钥可能无效
    • iis启用GZIP压缩Css javascript文件无效的原因及解决

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有