tags:

views:

574

answers:

4

I am building a service using WCF and I need to send over images. I looked around on how this is done and found that Base64 encoding is often used to send binary data as text. Is this a good practice to send over images (~500 kb)?

+1  A: 

That's a really big message, but yes, if you must send them, base 64 is the way to go. If you only have .net clients then you could look at binary message encoding to shrink the size down

blowdart
+3  A: 

Base64 is safely encodes binary data, it will be fine. Just keep in mind it makes the transfer size about 30% larger.

Csaba Kétszeri
A: 

We have sent images / files over WCF using byte arrays, up to several MB in size.

You can use MTOM for large files. See:

http://developers.de/blogs/damir_dobric/archive/2008/02/02/wcf-mtom-binary-data-transmission.aspx

Shiraz Bhaiji
A: 

Why do you need to send the binary data as text? HTTP can send binary data, why not make your image available via HTTP and send a URL in your WCF service?

Dour High Arch
Good point. This is something that I was thinking about as well. One of my concern is that images are already being used on a intranet site hosted on internal servers and would have to be moved on a server that can be accessed by client via the web.
Rakshit Pai