RY4N
RY4N

Reputation: 1112

WCF best practice/configuration for streaming downloads

I'm creating a service that will download files from a server, I Have a limited knowledge in this area and am asking advise on the settings for the service.

I have ruled out full file buffering on account of the memory usage that would impact on the server.

Which binding would be best used in a WCF for streaming downloads securely ? wsHttpBinding, basicHttpBinding, netTcpBinding etc

and if its not too much trouble could you write a few lines saying why your answer suits the functionality correctly ? (so i learn from the answer)

Thanks

ry4n

(currently working on Vs2008)

Also what format would information best be returned to be consumed by android ?

Update* More info: File Sizes: Between 1MB and 1GB, Multiple downloads concurrently.

Which WCF configurations should i employ to achieve this functionality ?

Upvotes: 3

Views: 845

Answers (1)

Emre Aydinceren
Emre Aydinceren

Reputation: 96

Not Streamed Mode: To most people familiar with WCF will say NetTcp with TransferMode.Streamed, however there are serious performance problems with that. Streaming will let you accommodate more concurrent downloads because it will not hog server's memory but WCF has a non-override-able stream chunks size, it slows down the download, a file over 100MB will be significantly slower that any other methods.

I suggest implement chunking method method, such as

byte[] GetBytes(int chunkNumber);

At the client side you can stitch the chunks as you download. Use HttpBinding for interoperability, since all you are transferring are bytes you will not incur too much overhead over NetTcp binding.

Upvotes: 1

Related Questions