I am trying to upload large CSV files via my WEB API. Now this has worked correctly till i was uploading file with size 350 MB. Now i have got one file with size 400 MB which is not getting uploaded via my API. It looks like byte array which i am posting is becoming null.
my C# code where i am posting this byte array to API - Buff is a byte array
HttpClient client = new HttpClient();
client.BaseAddress = new Uri(apiurl);
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response = client.PostAsJsonAsync(APIUrl, buff).Result;
And the API method which getting called is -
[HttpPost]
[Route("api/UploadDocument/{Organisation}/{OriginalFileName}/{FlexFd}/{RecordRefEntityName}/{RecordRefId}")]
public IHttpActionResult UploadDocument([FromBody] byte[] File_Stream, string Organisation, string OriginalFileName, string FlexField1, string RecordRefEntityName, string RecordRefId, [FromUri] string FolderName)
{
EDocumentRepositry uploadedDocument = new EDocumentRepositry();
try
{
uploadedDocument = doc.UploadFile(File_Stream, Organisation, OriginalFileName, FlexField1, RecordRefEntityName, RecordRefId, FolderName);
return Ok(uploadedDocument);
}
catch (Exception ex)
{
}
}
Here File_stream showing as null when i post large byte (array.length showing the value as 407353839)
Now i have following config setting for API
<httpRuntime targetFramework="4.5.2" executionTimeout="100000" maxRequestLength="214748364" />
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>