WCF -Windows Communication Foundation supports three type of Message encoding
3) MTOM - Message Transmission Optimization Mechanism
In WCF Endpoint consists of ABC . A= Address , B=Binding , C=Contract.
Binding is the one tells how to exchange data transfer between endpoints (WCF Service to WCF Client).
Encoding : Is a Process of transforming a message into a sequence of bytes. Decoding is the reverse process. Windows Communication Foundation (WCF) includes three types of encoding for SOAP messages: Text, Binary and Message Transmission Optimization Mechanism (MTOM).
In WCF you can specify Message encoding in type in Binding element in Application Configuration file as shown below.
<binding name="wsWithMTOM" maxReceivedMessageSize="665536" messageEncoding="Mtom"/>
Let See in Action
Lets define a WCF Service with One Operation Contract called GetImage .
Here is the Implantation of GetImage Operation Contract.
Here is the WCF Service Configuration Line
maxReceivedMessageSize - Make sure that you increase the size of this both Service and Client Configuration file.
maxArrayLength - Increase the size on Client side configuration .
This is the error message you get if the size of the maxArrayLength is not big enough.
Here is the WCF Client code snippet
When you call GetImge Operation it will return Byte array , I am converting that to MemoryStream from that i am getting as Image . binding returned image to PictureBox control and here is the out put.