2014-06-21 61 views
2

我有一個用於上傳文件的異步方法。在我的web.config我已經設置了maxcontentlengthMVC中的大文件上傳問題

但我無法上傳大於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> 

回答

0

我解決了我的問題。這是從主機面板約enabling 32 bit applications

+0

奇怪 - 你知道爲什麼它需要做大量上傳? – cryss

+0

也許是因爲ISAPI過濾器。但不知道其他事情。我只是試圖解決我的問題。但由於那時候我的所有其他項目也因此而出現問題。現在一切都很好。 – Kadir