• [转载]windows 7 IIS 7.5 ASP.Net 文件上传大小限制


    原文出处:

    原文作者:云中岳

    原文链接:http://www.cnblogs.com/netlover/archive/2011/07/08/Win7_IIS_Upload.html

    IS 7 默认文件上传大小是30M
    要突破这个限制:

    1. 修改IIS的applicationhost.config

        打开 %windir%system32inetsrvconfigapplicationhost.config

        找到: <requestFiltering>节点,

      这个节点默认没有 <requestLimits maxAllowedContentLength="上传大小的值(单位:byte)" /> 元素,IIS 7和IIS 7.5上测试过  最大值只能是<requestLimits maxAllowedContentLength="4294967295" />  <4GB,

        为这个节点新增如下示例元素:<requestLimits maxAllowedContentLength="2147483647" /> ,上传的大小将改为2G

    注意: %windir%system32inetsrvconfigapplicationhost.config 文件一定不要用其他机器的文件替换,否则IIS将无法启动

    此文件记录了,当前IIS中所有Site , App pool的信息,还有一些与机器相关的配置。

    2. 修改web.config

    <system.web>
    <httpRuntime executionTimeout="36000" maxRequestLength="2097151"/> <!--maxRequestLength:上传的大小,单位K ,executionTimeout:设置超时时间,单位:秒。(默认是90秒) -->
    </system.web>

    注意:这个maxRequestLength最大值只能是2097151K,设置大于这个值将会出现如下错误:

    Configuration Error
    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 
    Parser Error Message: The value for the property 'maxRequestLength' is not valid. The error is: The value must be inside the range 0-2097151.
    Source Error: 
    Line 117:    <httpHandlers />
    Line 118:    <customErrors mode="RemoteOnly" />
    Line 119:    <httpRuntime executionTimeout="36000" maxRequestLength="4194304" />
    Line 120:    <authentication mode="Windows" />
    Line 121:    <identity impersonate="true" />

    3. web.config下如果有如下节点(此节点是为IIS 7设计的) ,则修改

    <requestLimits maxAllowedContentLength="2147483647" /> 单位与applicationhost.config中的<requestLimits maxAllowedContentLength="2147483647" />一致,它的最大值也只能为4294967295
    <system.webServer>
    <security>
    <requestFiltering>
    <requestLimits maxAllowedContentLength="2147483647" />
    </requestFiltering>
    </security>
    </system.webServer>

    总结:asp.net(IIS 7 and IIS 7.5)上传文件的最大值不能超过2GB

  • 相关阅读:
    struts2实现的简单的Trie树
    从源码总结struts2命名空间的匹配规则
    Knockout2.x:ko.dataFor()、ko.contextFor()使用
    Reporting Services可選參數設置
    在.net CF中設置DataGrid中列的寬度
    VB.net 簡體繁體轉化代碼
    在SQL語句中獲取錯誤信息
    VS 2005 使用 Crystal report 發生載入報表失敗
    Lazarus一個奇怪的設置
    怎样用wince设备创建快捷方式
  • 原文地址:https://www.cnblogs.com/Scl891004X/p/6171863.html
Copyright © 2020-2023  润新知