Explain Binary vs MTOM vs Streaming in WCF?

Technology CommunityCategory: WCFExplain Binary vs MTOM vs Streaming in WCF?
VietMX Staff asked 3 years ago
  • MTOM is a standard that uses multi-part mime-encoded messages to send portions of the message that are large and would be too expensive to base64 encode as pure binary. The SOAP message itself is sent as the initial part of the message and contains references to the binary parts which a web service software stack like WCF can then pull back together to create a single representation of the message.
  • Binary encoding is entirely proprietary to WCF and really doesn’t just have to do with large messages. It presents a binary representation of the XML Infoset which is far more compact across the wire and faster to parse than text based formats. If you happen to be sending large binary chunks of data then it just fits right in with the other bytes that are being sent.
  • Streaming can be done used with any message format. That’s more about when the data is written across the network vs. being buffered entirely in memoery before being presented to the network transport. Smaller messages make more sense to buffer up before sending and larger messages, especially those containing large binary chunks or streams, necessitate being streamed or will exhaust memory resources.