[英]Unable to upload file size larger than 200 MB in ASP.NET Core Web API
[英]Why are uploaded files to ASP.NET web Application greater than 12MB being shown as 0MB?
我们的ASP.NET C#Web应用程序用于以下环境 - .NET Framework 4 - IIS 7 - Windows 2008 - Visual Studio 2010 .NET IDE - C# - HTTPS(SSL)我们的ASP.NET C#Web应用程序上载各种文件,如jpgs ,mp4,mp3,pngs,docx,txt等到名为ClientBin的文件夹。 但是,如果我们将应用程序部署到IIS7服务器,我们必须向我们的应用程序的Web用户授予上载文件的权限。 我们赋予\\ IIS_IUSRS组在ClientBin上传文件夹上执行,读取,写入和执行的权限。
Web用户可以上载大小小于12MB的文件。
但是,当Web用户上传的内容超过大约12MB时,上传的文件将在服务器的ClientBin上传文件夹中为0字节。
在我们的Web.config中,我们对httpRuntime标记进行了以下配置:
<system.web>
...
.....
........
..............
<httpRuntime maxRequestLength="1048576" executionTimeout="50000"
useFullyQualifiedRedirectUrl="false" requestLengthDiskThreshold="15360"
minFreeThreads="8" minLocalRequestFreeThreads="4"
appRequestQueueLimit="100" />
</system.web>
在我们的Web.config中,我们有requestLimits
标记的以下配置:
<system.webServer>
..............
.........................
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2000000000" />
<fileExtensions>
<add fileExtension=".aspx" allowed="true" />
</fileExtensions>
</requestFiltering>
</security>
</system.webServer>
我还通过创建以下设置采取了不受欢迎的方法来修改machine.config文件:
<system.web>
<processModel responseDeadlockInterval="0:09:00"
responseRestartDeadlockInterval="0:09:00" />
.....................
..........................................
.............................................................
</system.web>
我还采取了以下步骤:我检查了事件查看器和IIS日志,但它没有显示奇怪。
大小小于约12 MB的文件可以正确上载。
重要的是要注意文件确实上传,但它们都以0Kb结束。 上传的文件名和类型与我桌面上的文件名和类型相同,但大小为0Kb。 我桌面上的那个大约是75MB。
ASP.NET和IIS不会抛出任何错误页面。
为什么上传的文件到大于12MB的ASP.NET Web应用程序显示为0MB?
尝试增加requestLengthDiskThreshold
以匹配maxRequestLength
<configuration>
<system.web>
<!-- maxRequestLength and requestLengthDiskThreshold is in Kilobytes-->
<httpRuntime maxRequestLength="204800" requestLengthDiskThreshold="204800" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<!-- maxAllowedContentLength is in Bytes not Kilobytes -->
<requestLimits maxAllowedContentLength="204800000" />
</requestFiltering>
</security>
</system.webServer>
</configuration>
另外,您是否尝试过使用更全面的ASP.NET上传控件,例如Telerik RadUpload模块? 它可作为免费试用版,以确定它是否能解决您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.