Этот код потоков больших файлов для наших пользователей:«Удаленный узел закрыл соединение» в Response.OutputStream.Write
// Open the file.
iStream = new System.IO.FileStream(filepath, System.IO.FileMode.Open,
System.IO.FileAccess.Read, System.IO.FileShare.Read);
// Total bytes to read:
dataToRead = iStream.Length;
// Read the bytes.
while (dataToRead > 0)
{
// Verify that the client is connected.
if (Response.IsClientConnected)
{
// Read the data in buffer.
length = iStream.Read(buffer, 0, 10000);
// Write the data to the current output stream.
Response.OutputStream.Write(buffer, 0, length);
// Flush the data to the HTML output.
Response.Flush();
buffer = new Byte[10000];
dataToRead = dataToRead - length;
}
else
{
//prevent infinite loop if user disconnects
dataToRead = -1;
}
}
Каждый раз и в то время как мы получаем это исключение:
The remote host closed the connection. The error code is 0x80072746
Вот полная трассировка стека:
Stack Trace:
at System.Web.Hosting.ISAPIWorkerRequestInProcForIIS6.FlushCore(Byte[] status, Byte[] header, Int32 keepConnected, Int32 totalBodySize, Int32 numBodyFragments, IntPtr[] bodyFragments, Int32[] bodyFragmentLengths, Int32 doneWithSession, Int32 finalStatus, Boolean& async)
at System.Web.Hosting.ISAPIWorkerRequest.FlushCachedResponse(Boolean isFinal)
at System.Web.Hosting.ISAPIWorkerRequest.FlushResponse(Boolean finalFlush)
at System.Web.HttpResponse.Flush(Boolean finalFlush)
at System.Web.HttpResponse.Flush()
at System.Web.HttpWriter.WriteFromStream(Byte[] data, Int32 offset, Int32 size)
at System.Web.HttpResponseStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at BIS.DocumentBus.Controls.DocumentViewer.StreamFile(String filepath)
У нас никогда не было доказательств того, что у пользователей возникли проблемы с загрузкой наших файлов и планируете просто игнорировать это исключение.
Любая идея, что является источником этой проблемы? Можно ли игнорировать?
Возможный дубликат [Удаленный хост закрыл соединение. Код ошибки: 0x800704CD] (http://stackoverflow.com/questions/5564862/the-remote-host-closed-the-connection-the-error-code-is-0x800704cd) –