Search code examples
c#.netdevexpressdevexpress-mvc

Out of memory exception when dowloading file (DevExpress Filemanager)


I am using DevExpress and on the server side I have the following:

var fileStreamResult = FileManagerExtension.DownloadFiles(settings, provider, FileManagerFileDownloadingEventHandler);

Where the provider is an AzureProvider. The settings are:

settings.SettingsEditing.AllowDownload = true;
settings.Settings.AllowedFileExtensions = new[] {".avi", ".mov"};

Now if I download a file that is ~30 MB, it works fine but when I try it with a file that is 200 MB, then .DownloadFiles returns null.

Also when I look at the first chance exceptions I see:

System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.at System.IO.MemoryStream.set_Capacity(Int32 value)

I don't know what the problem is but I have also set the following in my config file:

  <requestFiltering>
    <requestLimits maxAllowedContentLength="30000000" />
  </requestFiltering>

I played with the above value adding extra zeros but, still no luck.

Anyone has any ideas? thanks.

Edit: please note that the upload of 200MB is fine. The problem occurs during downloading


Solution

  • Thanks to DevExpress support, they highlighted it was because IIS Express runs out of memory, as it is possibly being run as a 32-bit process. So changing Visual Studio to use the 64-bit did the trick. Hopefully this helps someone in the future:

    How to change Visual Studio option to use the 64-bit version of IIS Express