How to transfer a large file using WCF

I need to transfer large Excel files through WCF service. Our project requires the creation of several reports for clients, and we use Excel to create reports.

Now the project uses the net.tcp binding, but we are considering switching to the http binding.

I read another post on SO about large image transfer and answers, all of which were suggested via streaming. However, I am wondering what the best approach would be considering his Excel file. File sizes can sometimes approach ~ 10 MB.

+6
wcf
source share
2 answers

Yes, streaming will run TCP or HTTP - you must use it. Using streaming eliminates the need to have large buffers in memory containing the entire file at once. This will increase the scalability of your application.

+7
source share

As JP says, streaming is a good option - I would recommend this for this. The book Essential Windows Communication Foundation suggests that if you need reliable messages, digital signatures, or resumes after a failure, then another option is to manually cut data into smaller messages and then restore them to the server.

+2
source share

All Articles