开发者

What's the best practice for transferring huge binary files with ASP.NET?

Consider an ASP.NET page with this code:

while (read)
{
   Response.OutputStream.Write(buffer, 0, buffer.Length);
   Response.Flush();
}

The application should be highly performance-tuned and handle thousands on concurrent requests and the main purpose is transferring huge binary file to clients over high speed connecti开发者_如何学JAVAons. I can do the job with an ASP.NET page, with HTTP Handler, IHttpAsyncHandler, ISAPI filter and ...

The question is what is the best choice for this purpose ?


If the page is liable to be I/O bound then I'd go the Async road. But you should use the asynchronous read methods (if available) on your Stream object as well.

For more information see:

FileStream Constructor - with async example

To address your comment that you receive this data via a socket, you'll also find that most of the System.Net.Sockets namespace classes support asynchronous behaviour.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜