what is the difference between binding and binding extension in WCF?
There's three different ways to use bindings in WCF. You can:
- Use the default bindings that come with WCF (e.g. wsHttpBinding, webHttpBinding, etc.);
- Customize a default binding so you can use it across different service endpoints (e.g. binding configuration); and,
- Use binding extensions to create your own custom binding that derives from the abstract Binding class which are usually composed of pre-defined BindingElements (such as your Transport and Message Encoding).
So, the difference between binding and binding extensions is the degree of customization. Using 'binding', as you said, is really using one of the pre-defined bindings that come with WCF. Probably for 60-70% of your situations, that will work for you. A binding extension requires you to create your own Binding class (deriving from the abstract Binding) and you are able to piece together the various BindingElements that come with WCF into your own customized binding. (Or, you can create your own BindingElement.)
So your question is really one of extremes on the WCF binding spectrum -- 'binding' is pre-defined, ready to use bindings that you associate to your endpoints and 'binding extension' is totally customized that requires you to code your binding before assigning it to an endpoint.
BTW, Aaron Skonnard has written a number of good articles for MSDN on WCF internals - I highly recommend that you check out his articles. Two that are very good are here and here.
I hope this helps.+