Poor Response.Output.Write performance with Internet Explorer 9 on Windows 7

Coderx

New Member
We have a ASP .NET web server that sits on IIS7. In order for our server to be able to transfer large files (let's say 30-50MB) to the web client, we implemented the Response.Output.Write algorithm as found here: http://support.microsoft.com/?kbid=812406.Here's a snippet of our code:\[code\]long offset = 0, cb = info.AudioStream.Length;context.Response.Clear();context.Response.ClearHeaders();context.Response.ContentType = "audio/wav";context.Response.Cache.SetNoStore();context.Response.AddHeader("Content-Length", cb.ToString());context.Response.AddHeader("Content-Disposition", "attachment; filename=" + info.RecordingId + ".wav");context.Response.Buffer = false;context.Response.BufferOutput = false;context.Response.Flush();info.AudioStream.Seek(offset, SeekOrigin.Begin);byte[] buffer = new byte[1024 * 1024];long total = 0;int count;Tracer.TraceInfo(true, "WaveHandler::ProcessRequest; Before loop.");while (context.Response.IsClientConnected && total < cb && (count = info.AudioStream.Read(buffer, 0, (int)Math.Min(buffer.Length, cb - total))) != 0){ Tracer.TraceInfo(true, "WaveHandler::ProcessRequest; Before 'Write'; Count: " + count); context.Response.OutputStream.Write(buffer, 0, count); Tracer.TraceInfo(true, "WaveHandler::ProcessRequest; After 'Write'; Total: " + total); total += count;}Tracer.TraceInfo(true, "WaveHandler::ProcessRequest; After loop.");context.Response.Flush();\[/code\]The problem is that from the same Windows 7 client PC, transferring a ~35MB file when using firefox 15.0 takes 5 seconds but the same operation with IE9 takes ~3m30s. On another XP client PC with IE8, it takes 10 seconds to transfer the same ~35MB file.We tried to play with the transmit buffer size (from 4kB to 1MB) or to put a 'Response.Flush()' inside the loop but we always have the same poor performance with IE9.We don't know which end needs tweaking: the web server side or the client side?Any idea?Thanks
 
Back
Top