WebFile.Open out of memory

[quote=398773:@Greg O’Lone]Keep in mind that uploads can be kept in memory more than once:

  1. The raw HTTP request
  2. If you ask for the raw data, it gets loaded into a buffer in the WebUploadedFile before it’s handed to you.
  3. if you then use a BinaryStream or a TextOutputStream, the data is transferred again

For the best performance, don’t request the raw data. Just copy the folderitem to another location on disk and then load it yourself if that’s what you want to do.

Also, I suggest that you try compiling your app using Moderate or Aggressive optimization. You may find that the framework can handle things a little faster that way.[/quote]
Sorry about that. It was late and I thought you were talking about uploads.

Some of the same rules apply though, just in different ways.

You can help the framework with large downloads by serving them in HandleUrl or HandleSpecialUrl though. If you make a WebFile that points to a file on disk, we incrementally load and transfer that data to the socket instead of loading it all at once. You may find that it will handle that better.

To be honest, transmitting any large files through a web app will be an issue though. What I usually suggest as these files are typically static is to put them on a CDN somewhere and use protected one-off URLs in the app itself to move the burden and bandwidth elsewhere.