Search code examples
c#wcfimage-processingwcf-binding

Preferred Binding to use for image uploading


I am uploading images as byte arrays as qucikly as possible.

I have used basicHttpBinding with MTOM encoding.

An image could be 19K or 80K in size.

I have also used net.tcp binding.

I am only interested in one-way communication - namely from client to server.

I have read that net.tcp is quicker but can have issues with firewalls?

Should I stick to basicHTTPBinding with MTOM enabled?

Thanks


Solution

  • The question is better answered if the application is for Internet or intranet clients.

    If it is for the intranet and both client and server are using WCF; and require connected communication, stick to TCP. TCP is binary and therefore faster. [1]

    If it is for the Internet and you need non-WCF clients, stick to HTTP variants. It may not be as fast as binary protocols like TCP, but what you lose in performance you gain in wider client base and firewalls are less of an issue. [1]

    EDIT: In response to your comment below about WCF Internet clients I would recommend basicHttpBinding mainly because of firewalls. If your messages are large then enable MTOM as you mentioned. Again refer to Lowy in the book below.

    [1] - Lowy, "Programming WCF Services", O'Reilly Media