WCF different endpoint per method?
-
08-10-2019 - |
Question
Is it possible to restrict a method in WCFService to only respond to a particular endpoint?
e.g. I have a service that has multiple methods, one of which will be receiving a file. I have exposed two endpoints, one using MTOM.
Is it possible to only allow MTOM for the "file" method.
If the end user wants to use MTOM for all the other calls, that their call, but I need to insist on it for the "file" method.
Solution
I believe that bindings can be specified at the ServiceContract
level only. I think you would need to create a separate ServiceContract
containing the method you want to use a separate binding for, then specify in the service configuration that it is to use a binding that utilizes MTOM encoding. You could go further and create a custom binding that only allows MTOM encoding.