Reputation: 6855
I have a controller action in my mvc 4 project that gets POST request that includes files. I am posting data with XMLHttpRequest to server. When I select 10mb or smaller files to upload, upload process is successfull. But when I select 40Mb files to upload, a 404 error is occuring.
Failed to load resource: the server responded with a status of 404 (Not Found)
var formData = new window.FormData();
formData.append(this.file.name, this.file);
this.ajax = new XMLHttpRequest();
this.ajax.open("POST", "@Url.Action("FileUpload", "MyController", new { id = Model.Id })");
this.ajax.send(formData);
I put a breakpoint to my action method, small files post catched but big file requests did not come to the server, directly gives 404 error on browser console.
My action method is like this:
[HttpPost]
public ActionResult FileUpload(string id)
{
return Json("", JsonRequestBehavior.AllowGet);
}
I setted web config file limits like this.
<httpRuntime targetFramework="4.5"
maxRequestLength="2000000000"
executionTimeout="300"/>
Upvotes: 2
Views: 2457
Reputation: 1014
You can set your web config security settings like this.
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2000000000"/>
</requestFiltering>
</security>
Upvotes: 4