2014-10-18 2 views
8

ASP.NET MVC 5 응용 프로그램에서 크기가 5.25 MB 인 mp4 비디오 파일을 업로드하려고합니다.System.Web.HttpException (0x80004005) : 최대 요청 길이를 초과했습니다.

이 문제를 해결하기 위해 대부분의 경우 허용 된 답변 인 Web.config 파일에 추가하려고 시도했습니다. 내가 System.Web.HttpException (0x80004005): Maximum request length exceeded.

를 얻고 파일을 업로드 갈 때

<system.web> 
    <!-- This will handle requests up to 1024MB (1GB) --> 
    <httpRuntime maxRequestLength="1048576" /> 
</system.web> 
아마 뭔가 나는 또한,

<httpRuntime maxRequestLength="1048576" executionTimeout="3600" /> 

그러나의 Web.config에서뿐만 아니라 제한 시간을 설정하려고했습니다

이 그 컨트롤러 또는보기에서 설정해야합니까?

컨트롤러 :

[HttpPost] 
public ActionResult Index(HttpPostedFileBase file) 
{ 
    if (file != null && file.ContentLength > 0) 
    { 
     var fileName = Path.GetFileName(file.FileName); 
     if (fileName != null) 
     { 
      var path = Path.Combine(Server.MapPath("~/Content/Videos"), fileName); 
      file.SaveAs(path); 
     } 
    } 
    return RedirectToAction("Index"); 
} 

보기 :

@using (Html.BeginForm("Edit", "Posts", FormMethod.Post, new { enctype = "multipart/form-data" })) 
{ 
    <input type="file" name="file" /> 
    <input type="submit" value="OK" /> 
} 

가 어떻게 ASP.NET MVC 5에 비디오 파일을 업로드하나요?

+2

이 도움이 될 수 있습니다. http://stackoverflow.com/questions/3853767/maximum-request-length-exceeded –

+0

이 질문은 http://www.google.com/#q=Maximum%와 정확히 일치하므로 주제와 관련이없는 것으로 보입니다. 20request % 20length % 20 초과했습니다 –

+3

@ ta.speot.is "Google에서 찾을 수 있습니다"절대로 주제에서 벗어나지 않습니다. 다른 SO 질문의 사본이된다는 것은 그것을 복제물로 폐쇄 할 수있게합니다. –

답변

13

은 Web.config의이 추가 시도 (바이트!) :

<system.webServer> 
    <security> 
     <requestFiltering> 
     <requestLimits maxAllowedContentLength="1073741824" /> 
     </requestFiltering> 
    </security> 
</system.webServer> 
관련 문제