wcfmtomwcf-4

Custom MTOM Binding in WCF 4


Since WPF 4 provides default configuration out of the box, I'm having difficulty trying to create a custom MTOM binding for my service. In short, my WCF library hosts several services that are using basic HTTP. One of the services is used for file uploads and requires MTOM. What can I do so that only my file upload service uses a custom defined MTOM binding and the rest use the default?

This is what I have so far:

<bindings>
  <basicHttpBinding>
    <binding
      name="FileTransferBinding"
      transferMode="Streamed"
      messageEncoding="Mtom"
      maxBufferSize="65536"
      maxReceivedMessageSize="10485760">
    </binding>
  </basicHttpBinding>
</bindings>
<services>
  <service name="FileTransferService">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="FileTransferBinding" contract="MyServices.IFileTransfer"/>
  </service>
</services>

Thanks in advance!


Solution

  • In order to configure a service, the service name in the <service> element needs to be the type fully qualified name of the class implementing the service, in order to identify the service that is being configured administratively.

    <service name="MyNamcespace.FileTransferService">
    

    Service element MSDN:

    Name : Required String attribute that specifies the type of the service to be instantiated. This setting must equate to a valid type. The format should be Namespace.Class.