How to change binding properties(custom binding)


Uri baseAddress = new Uri(“http://localhost:8081/testsvc”);


ServiceHost sh = new ServiceHost(typeof(CalculatorService), baseAddress);


WSDualHttpBinding b = new WSDualHttpBinding();


BindingElementCollection bec = b.CreateBindingElements();


 


TextMessageEncodingBindingElement sbe = bec.Find<TextMessageEncodingBindingElement>();


sbe.MessageVersion = MessageVersion.Soap11WSAddressingAugust2004;


 


CustomBinding cb = new CustomBinding(bec);


sh.AddServiceEndpoint(“WCFSAMPLES.ICalculatorDuplex”, cb, “”);


sh.Open();


Console.WriteLine(“service is ready”);


Console.ReadKey();


 


 

SvcUtil.exe.config