views:

39

answers:

2

Hello,

I have a CustomBinding and a CustomMessageEncoder, CustomMessageEncoderFactory and a CustomMessageEncodingBindingElement.

I want my CustomBinding to use this CustomMessageEncoder.

But how can I configure this in my config file?

Thanks,

Michiel

A: 

I'm not sure I understand what you want here. Are you referring to how to make your own custom binding that can be configured through the config file, or how to use a CustomBinding in a config file?

If it's the latter, the WCF docs explain pretty well what you need: http://msdn.microsoft.com/en-us/library/ms731377.aspx

tomasr
+1  A: 

You can configure your CustomBinding and Encoder, within the configuration element of your web.config, like so:

<system.serviceModel>
    <bindings>
      <customBinding>
        <binding name="CustomBindingWithCustomMessageEncoder">
          <CustomMessageEncoder />
        </binding>
      </customBinding>
    </bindings>
    <extensions>
      <bindingElementExtensions>
        <add name="CustomMessageEncoder" type="Full.NameSpace.To.CustomMessageEncoderBindingElementExtension, Assembly.CustomMessageEncoder.Lives.In, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xyz" />
      </bindingElementExtensions>
    </extensions>
  </system.serviceModel>
moerketh
Thanks for your answer. I had to create the "CustomMessageEncoderBindingElementExtension".
Michiel