【发布时间】:2016-06-14 23:48:18
【问题描述】:
我希望我的 Web 应用程序在服务器上上传大 zip 文件。这是我的代码逻辑:
@using (Html.BeginForm("AddApplication", "Admin", FormMethod.Post, new { enctype = "multipart/form-data", @class = "form-horizontal", role = "form" }))
{
<div class="form-group">
<span>PUT FILE HERE : <input style="min-width: 550px;" type="file" name="zippedApp" /></span>
</div>
}
反手c#代码:
[HttpPost]
public ActionResult AddApplication( string description, HttpPostedFileBase zippedApp)
{
//code
}
没有达到 C# 函数......甚至在它进入我拥有的函数之前:
HTTP 错误 404.13 - 未找到
所以我读到了这个:
IIS7 - Webrequest failing with a 404.13 when the size of the request params exceeds 30mb
这让我觉得没有人真正知道答案。因为就我而言,我确信它与 MVC web.Config 有关。
我在我能找到的每一个配置中都添加了一堆<httpRuntime targetFramework="4.5.2" maxRequestLength="102400" executionTimeout="6000" />...但还没有成功。
【问题讨论】:
-
您可能必须对 IIS 本身进行一些更改。请参阅本文了解更多详细信息,具体取决于您的 IIS 版本:ajaxuploader.com/large-file-upload-iis-asp-net.htm。它没有到达您的方法的原因是因为 IIS 甚至在到达控制器之前就已经过滤掉了您的请求(请记住,请求通过 IIS 才能到达您的应用程序)。确保过滤器允许超过默认限制。
-
在我的问题中告诉你 IIS 是完美的,其他应用程序也能做到这一点
-
尝试设置 maxAllowedContentLength 属性。
层次结构为:system.webServer -> security -> requestFiltering -> requestLimits
标签: c# asp.net-mvc file-upload web-config