我写了一个继承自CustomBinding的自定义绑定类。 我的自定义类重写了BuildChannelFactory方法,并使用自定义ChannelFactory创建自定义通道。WCF CustomBinding配置
我在使用WCF客户端中的自定义绑定类时遇到了困难。 我能够用我的自定义绑定类,如果我在代码中进行配置:
Binding myCustomBinding = new MyCustomBinding();
ChannelFactory<ICustomerService> factory =
new ChannelFactory<ICustomerService>(myCustomBinding,
new EndpointAddress("http://localhost:8001/MyWcfServices/CustomerService/"));
ICustomerService serviceProxy = factory.CreateChannel();
serviceProxy.GetData(5);
我的问题是我不知道如何在App.config文件中配置它。 它是一个customBinding元素还是一个bindingExtension元素?还有别的吗?