How to configure a CustomBinding to use a CustomMessageEncoder in a config file
I have a CustomBinding and a CustomMessageEncoder, CustomMessageEncoderFactory and a CustomMessageEncodingBindingElement.
I want my Custo开发者_开发知识库mBinding to use this CustomMessageEncoder.
But how can I configure this in my config file?
Thanks,
Michiel
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>
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
精彩评论