Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to transfer large file using WCF

Tags:

wcf

I need to transfer large Excel files over a WCF service. Our project requires generating some reports for the clients, and we use Excel to generate the reports.

Right now the project uses net.tcp binding, but we are considering switching over to http binding.

I read another post on SO about transferring large images and the answers all suggested using streaming. However I'm wondering what the best approach would be considering its an Excel file. The file sizes can sometimes approach ~10Mb.

like image 531
Danish Munir Avatar asked Aug 21 '09 07:08

Danish Munir


2 Answers

Yes, streaming will work TCP or HTTP -- you should use it. Using streaming will remove the need to have large in-memory buffers holding the entire file at once. This will increase scalability of your application.

like image 67
JP Alioto Avatar answered Nov 07 '22 03:11

JP Alioto


As JP says streaming is a good option- I would generally recommend going for that. The book "Essential Windows Communication Foundation" suggests that if you need reliable messaging, digital signatures or resuming after failure then another option is to manually chunk the data into smaller messages and then reconstitute them on the server.

like image 42
RichardOD Avatar answered Nov 07 '22 03:11

RichardOD