【问题标题】:Large files upload issue in MVCMVC中的大文件上传问题
【发布时间】:2014-08-12 04:45:36
【问题描述】:

我有一个异步上传文件的方法。在我的web.config 中,我已经设置了maxcontentlength

但我无法上传大于 15mb 的文件。它给了我一个错误err_connection_reset。 我的主机还支持最大 1gb 文件上传和 90 秒执行超时。

这是我的代码示例。

[NoAsyncTimeout]
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Create(Videos video)
{
    if (ModelState.IsValid)
    {
        if (video.CategoryId > 0)
        {
            if (Request.Files.Count > 0)
            {
                try
                {
                    //Server.ScriptTimeout = 9001;
                    file.SaveAs(path);

                    // ... other operations
                }
                catch (Exception ex)
                {
                    string error = ex.Message;
                }
            }
        }
    }
}

这是我的web.config 属性。我还尝试设置最大执行超时。

<httpRuntime targetFramework="4.5" maxRequestLength="1073741824" requestValidationMode="2.0" />
 <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="1073741824" />
      </requestFiltering>
    </security>

【问题讨论】:

    标签: asp.net-mvc file-upload asp.net-mvc-5


    【解决方案1】:

    我解决了我的问题。这是关于来自托管面板的enabling 32 bit applications

    【讨论】:

    • 奇怪 - 你知道为什么需要进行大型上传吗?
    • 可能是因为 ISAPI 过滤器。但对其他事情一无所知。我刚试过,它解决了我的问题。但从那时起,我的所有其他项目也因此而出现问题。现在一切都很好。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-10-20
    • 1970-01-01
    • 1970-01-01
    • 2022-10-07
    • 2013-05-07
    • 2012-10-05
    • 2015-01-23
    相关资源
    最近更新 更多