I have a few services hosted on a server. One service transfers a ZIP file to the client ~2kB. Another one transmits an xml representation of a DataSet ~ 10kB. The others just transfer small amounts data ~<1kB. The file transfer service and the data set service will potentially grow in size in the future.
Will it harm anything if I just use one binding for all 3 of these services with this one binding using MTOM encoding? Is WCF/MTOM smart enough to know when to optimize?
If MTOM is enabled, WCF won’t use it unless the message being sent is over a certain size. So yes, you can enable it without impacting small messages. I haven’t found documentation that says just what that size is.
It’s worth noting that MTOM only applies to binary data (ie: byte array). If you’re returning a class that gets XML serialized instead, MTOM is unlikely to help you. In my experience even returning an array of 1000 of some custom class is still sent as XML text. So for what you’re returning I’m not sure you’ll gain anything. Marc Gravell’s answer talks about how to get around that by turning the DataSet into a byte array.