A WCF question came up recently on StackOverflow about using a binding for a custom transport through configuration instead of code. My initial reply was that you needed all the right configuration classes associated with your binding so that you could register the right binding extensions for the usage.
The question from there evolved into something more specific: Once I’ve got my binding collection element created and registered as an extension, what if I want to use it on an endpoint by specifying only the binding and not a bindingConfiguration (like you can do with the standard bindings). In other words, do this:
<system.serviceModel>
<extensions>
<bindingExtensions>
<add name="myBinding"
type="MyNamespace.MyBindingCollectionElement, MyBinding" />
<services>
<service name="server">
<endpoint address="my://localhost:8484" binding="myBinding">
.serviceModel>
In theory this should just work, but it didn't for the original poster. I had a sample app set up for one of my custom WCF transport channels, and had tested it, so I knew something was amiss, but didn't notice it at first. That is, until the original poster uploaded a sample app and I could reproduce the problem.
The solution was simple, but unexpected: It turns out that WCF won't recognize your custom binding name unless you've got a
section in your configuration file. Mind you, it doesn't need for you to actually add a configuration for your custom binding there at all, just that an empty bindings section exists. In other words, just adding this would fix the problem:
<bindings/>