“The remote host closed the connection” in Response.OutputStream.Write

前端 未结 4 1544
清酒与你
清酒与你 2020-12-28 15:31

This code streams large files to our users:

                // Open the file.
            iStream = new System.IO.FileStream(filepath, System.IO.FileMode.Ope         


        
4条回答
  •  臣服心动
    2020-12-28 15:39

    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

提交回复
热议问题