songyl

导航

IIS 7 中设置文件上传大小的方法

在IIS 6.0中设置文件上传大小的方法,就是配置如下节点:

   <system.web>
       <httpRuntime maxRequestLength="1918200" executionTimeout="600"/>        
   </system.web>

但在IIS7中,设置如上设置后,不管设置多大数值,最大上传了限制为30M

还要进行如下设置才能正确:

 

在web.config中加入如下配置:

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

 直接放在<configuration>   </configuration>中即可。

1048576000是指字节数。

如果一个文件大小是:31566145字节,
maxAllowedContentLength设置31576145是可以实现上传的,但是如果设置成31566145,上传会失败。估计是跟上传时请求消息的额外开销有关系。


最上面的:
<httpRuntime maxRequestLength="1918200" executionTimeout="600"/>    
不再有任何用处。

posted on 2015-12-15 16:51  songyl  阅读(383)  评论(0编辑  收藏  举报