简体   繁体   中英

What components(binding elements) are NetTcpBinding and WsHttpBinding made of?

All bindings in WCF are made of transport,...,transaction components/elements.

Can anyone tell me where can I find the exact configurations of bindings mentioned in the title?

It's not possible to give a simple answer to this question, because the exact binding elements produced is not static and depends on the features requested at runtime depending on the configuration. For example, the security features required by a configuration of the binding will completely change the security binding element.

The most reliable way to see the elements created for a given configuration of a binding is to create and configure the binding, then invoke the CreateBindingElements() method. You can then investigate the returned collection to see what binding elements have actually been produced:

var binding = new WsHttpBinding();

// Configure the binding.

var elements = binding.CreateBindingElements();

foreach(var element in elements)
{
    Console.WriteLine(element.GetType().Name);
}

This is the method the runtime uses to configure an endpoint with a given binding.

您还可以使用WcfBindingBox将绑定转换为自定义绑定。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM