Error: Exception of type "System.OutOfMemoryException" was thrown. Server memory completely consumed by downloading an export file."

When a large Export file is downloaded this causes most or all available memory to be consumed on the server. All users may see poor performance in CRM and BBIS and may receive the error "Exception of type "System.OutOfMemoryException" was thrown.
Download and install the latest patch, which contains all fixes from previous patches. If you are running an older version, download and install the latest version and then the patch. 
As a temporary work around, there is a configuration that can be added to the web.config file that will reduce the impact ONLY when downloading CSV. XSLX files remain impacting.
If you are hosted, please ask Support to make this change, and refer to this article.
If you are not hosted, please add the following to the "<AppSettings>" section of the CRM "web.config" file on the application server:

<add key="FileDownloadBufferSize" value="5120" />

This may impact the speed of download, and in the case of an extremely large file, you may risk file truncation. Until this is resolved it is recommended that a large export (resulting in files over 100MB) be broken into smaller exports where possible, and always downloaded as a CSV.. 
As with all changes, please test thoroughly in a non-live environment first.

Environment

 3.0.516.43
 3.0.516.61 ; 4.0.138.2

Was this article helpful?