在ASP.NET MVC 5.1/IIS中,当上载请求大小大于4 MB时,请求从不返回?
我在Windows 7上创建了一个非常简单的ASP.NET MVC 5.1应用程序,其中包含IIS。我有一个非常简单的表单和控制器。我知道ASP.NET中的默认请求限制是4MB。但是当我上传大于4MB的文件时。我的请求永远不会回来。在Chrome、Firefox和IE上测试。实际上,我的控制器断点从未达到。我认为ASP.NET MVC async内部有问题。这是我的html表单在ASP.NET MVC 5.1/IIS中,当上载请求大小大于4 MB时,请求从不返回?,asp.net,asp.net-mvc,iis,iis-7.5,asp.net-mvc-5.1,Asp.net,Asp.net Mvc,Iis,Iis 7.5,Asp.net Mvc 5.1,我在Windows 7上创建了一个非常简单的ASP.NET MVC 5.1应用程序,其中包含IIS。我有一个非常简单的表单和控制器。我知道ASP.NET中的默认请求限制是4MB。但是当我上传大于4MB的文件时。我的请求永远不会回来。在Chrome、Firefox和IE上测试。实际上,我的控制器断点从未达到。我认为ASP.NET MVC async内部有问题。这是我的html表单 @using (Html.BeginForm("Add", "Product", FormMethod.Post, n
@using (Html.BeginForm("Add", "Product", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input type="file" id="files" name="files" placeholder="Title" accept="image/x-png, image/gif, image/jpeg" />
}
public async Task<ActionResult> Add(IEnumerable<HttpPostedFileBase> files)
{
更新:在Chrome上,我不断看到这一点。
您需要在web配置上设置maxAllowedContentLength
像这样:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="900000000" />
</requestFiltering>
</security>
</system.webServer>