大文件上传失败 [英] Large file upload fail
问题描述
我必须上传的文件大小不能超过1 Gb.
但是目前,只有241 MB的文件可以上传超过无法上传的文件.
在webconfig中,我添加了用于上传大文件的代码.
请给我提示我哪里错了.
我尝试过的事情:
I have to upload a file like 1 Gb or more than it have to upload.
but currently, only 241 MB file can upload more than it fails to upload.
In a webconfig I add code for upload large file.
Please give me hint where I am wrong.
What I have tried:
<system.webServer>
<security>
<!--<requestFiltering allowDoubleEscaping="true"/>-->
<requestFiltering allowDoubleEscaping="true">
<!-- This will handle requests up to 3000MB (3GB) -->
<requestLimits maxAllowedContentLength="3000000000" />
</requestFiltering>
</security>
</system.webServer>
<httpRuntime targetFramework="4.5.2" executionTimeout="9999" maxRequestLength="2097151" />
推荐答案
^ ]以千字节为单位,maxAllowedContentLength [
maxRequestLength[^] is measured in kilobytes and maxAllowedContentLength[^] is measured in bytes. They have to be equal.
For 1GB it would be:
web.config:
<configuration>
<system.web>
<httpRuntime maxRequestLength="1048576" />
</system.web>
</configuration>
IIS7及以上设置:
IIS7 and above settings:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
</system.webServer>
参见:
asp.net-超出了最大请求长度. [ asp.net-如何将maxAllowedContentLength设置为在IIS7上运行时有500MB? [ ^ ]
请求限制< requestLimits> | Microsoft文档 [ ^ ]
1字节,千字节,兆字节,千兆字节等是多少? [
See:
asp.net - Maximum request length exceeded.[^]
asp.net - How to set the maxAllowedContentLength to 500MB while running on IIS7?[^]
Request Limits <requestLimits> | Microsoft Docs[^]
How much is 1 byte, kilobyte, megabyte, gigabyte, etc.?[^]
添加到webconfig中(executionTimeout =" 9999还要求"maxRequestLength ="2097151")
add in webconfig (executionTimeout="9999" maxRequestLength="2097151"also requried)
<system.webServer>
<security>
<!--<requestFiltering allowDoubleEscaping="true"/>-->
<requestFiltering allowDoubleEscaping="true">
<!-- This will handle requests up to 3000MB (3GB) -->
<requestLimits maxAllowedContentLength="3000000000" />
</requestFiltering>
</security>
</system.webServer>
和
and
<httpRuntime targetFramework="4.5.2" executionTimeout="9999" maxRequestLength="2097151" />
这篇关于大文件上传失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!