[Asp.net]Uploadify上传大文件,Http error 404 解决方案

大文件上传

第一步:修改uploadify参数

'fileSizeLimit': '0',//单个文件大小,0为无限制,可接受KB,MB,GB等单位的字符串值
'fileTypeDesc': '文件',//文件描述Image Files
'fileTypeExts': '*.zip; *.rar; *.png',//允许上传的文件类型

测试,用一个大于30M的文件,进行上传测试。 

第二步:修改web.config

<configuration>
    <system.web>
        <compilation debug="true" targetFramework="4.5" />
            <!--maxRequestLength就是文件的最大字符数,最大值不能超过2个G左右,executionTimeout是超时时间--> 
        <httpRuntime targetFramework="4.5" maxRequestLength="1073741824" executionTimeout="3600" />
    </system.web>
</configuration>

测试,仍使用上面的文件,进行上传测试。

第三步:添加system.webServer节点

<configuration>
    <system.web> 
        <compilation debug="true" targetFramework="4.5" />
        <!--maxRequestLength就是文件的最大字符数,最大值不能超过2个G左右,executionTimeout是超时时间-->
            <httpRuntime targetFramework="4.5" maxRequestLength="1073741824" executionTimeout="3600" />
    </system.web> 
    <system.webServer>
        <security>
            <requestFiltering>
                <!--修改服务器允许最大长度-->
                    <requestLimits maxAllowedContentLength="1073741824"/>
            </requestFiltering>
         </security>
     </system.webServer>
</configuration>

测试,仍然用上面的文件,进行上传测试:

设置IIS

 打开IIS管理器,找到Default Web Site。先进行停止。

在IIS中双击“请求筛选”打开。

点击右边的“编辑功能设置”,打开“编辑请求筛选设置”对话框。

其中的允许的最大容量长度,默认是”30000000“,30M,将其修改为1073741824,即1G。

最后启动IIS.


内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://sulao.cn/post/254.html

我要评论

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。