This code streams large files to our users:
// Open the file.
iStream = new System.IO.FileStream(filepath, System.IO.FileMode.Ope
There are a few different possible causes of this. I can think of three:
One is filling the buffer with close to 2GB of data, but this shouldn't be the case here, since you are flushing regularly.
Another is indeed that described in the answer you previously accepted. It's very hard to reproduce, so I wouldn't assume it was necessarily wrong.
Another possible case, and the one I would bet on, is that the executionTimeout is exceeded, which would cause a ThreadAbortException at first, but this could in turn cause the failure of Flush() which would turn into the exception noted