Wcf IBindingConfigurationElement-如何实现和添加到配置中?

Wcf IBindingConfigurationElement-如何实现和添加到配置中?,wcf,configuration,binding,Wcf,Configuration,Binding,我正在尝试使用自定义绑定扩展WCF,这要求我替换WCF堆栈中的消息格式、编码和安全元素。为了便于使用此绑定,我希望以与内置绑定相同的方式从配置文件对其进行配置(即命名元素,而不是customBinding) WCF标准绑定都继承自,然后实现。如果实现此接口或从类继承,如何使配置元素可用于WCF配置系统?我进行了一些挖掘,并在MSDN上找到了该元素。尽管那里的文档表明可以通过这种方式添加绑定,但我查看了machine.config文件,发现在那里注册了以下3.5绑定: <bindingExt

我正在尝试使用自定义绑定扩展WCF,这要求我替换WCF堆栈中的消息格式、编码和安全元素。为了便于使用此绑定,我希望以与内置绑定相同的方式从配置文件对其进行配置(即命名元素,而不是
customBinding


WCF标准绑定都继承自,然后实现。如果实现此接口或从类继承,如何使配置元素可用于WCF配置系统?

我进行了一些挖掘,并在MSDN上找到了该元素。尽管那里的文档表明可以通过这种方式添加绑定,但我查看了machine.config文件,发现在那里注册了以下3.5绑定:

<bindingExtensions>
    <add name="wsHttpContextBinding" type="System.ServiceModel.Configuration.WSHttpContextBindingCollectionElement, System.WorkflowServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    <add name="netTcpContextBinding" type="System.ServiceModel.Configuration.NetTcpContextBindingCollectionElement, System.WorkflowServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    <add name="webHttpBinding" type="System.ServiceModel.Configuration.WebHttpBindingCollectionElement, System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    <add name="basicHttpContextBinding" type="System.ServiceModel.Configuration.BasicHttpContextBindingCollectionElement, System.WorkflowServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</bindingExtensions>

班级。这看起来是要从中继承并创建关联源的正确类

该集合是使用上面列出的语法注册的,然后应该与内置WCF绑定的功能完全相同。

这篇文章讨论了为绑定和绑定元素添加配置扩展,您应该在那里找到更多信息