Search code examples
c#.netiisumbracoumbraco7

Correct configuration to increase Umbraco Processing Memory


I keep getting a SystemOutOfMemoryException when processing large files like 1.6GB in size. I was just wondering if my configuration in web.config is correct. Below are the lines of code I modified to support large files that is more than 1GB in size

<httpRuntime requestValidationMode="2.0" enableVersionHeader="false" maxRequestLength="457286400" executionTimeout="3600" targetFramework="4.5" fcnMode="Single" />

<security>
  <requestFiltering>
    <requestLimits maxAllowedContentLength="3294967295" />
  </requestFiltering>
</security>

I'm not sure if this is correct. I also changed the IIS server to run in x64 via Tools-> Options-> Project and Solutions-> Web Projects -> "Use the 65bit version of IIS"

I'm not sure what I'm missing but I keep getting the system out of memory exception even though I already increased the memory size

UPDATE: I'm processing a large files like .mp4 files or just anytype of file regardless of type as long as the client requires it.

Also I'm not uploading the file using a frontend. What we do is upload the large file via Filezilla and if the file is uploaded to the server we use the Umbraco MediaService to process this file to have an entry in the Media Page. We are also using Hangfire to trigger our background service to process the MediaService


Solution

  • Managed to solve this issue by adding a 2nd and 3rd parameter in my Umbraco MediaService. Initially I was using Service.MediaService.Save(iMediaFile) but it seems that when using large file it needed to know who uploaded the file hence it needs the 2nd parameter which is the user_id and I added the third parameter to suppress any error message. As I was encountering an out of memory exception where in fact the error was I didn't pass the user_id in the second paramter. Hence my new code became Service.MediaService.Save(iMediaFile, user_id, false)

    Again the solution was not really a configuration as my configuration was enough to process the file. The error was due to missing 2nd parameter