Set binding and address of WCF service using c# code

Posted by Blessyjees under C# category on | Points: 40 | Views : 3264
We can set binding type and enpoint address by code.
We have already add the service reference to the project and try below code
 GatewayProxy.GatewayClient gatewayProxy;
BasicHttpBinding basicHttpBinding = new BasicHttpBinding();
EndpointAddress endPoint = new EndpointAddress("http:localhost:11105/Gateway.svc?wsdl");
basicHttpBinding.MaxBufferSize =65536;
basicHttpBinding.MaxReceivedMessageSize = 65536
XmlDictionaryReaderQuotas readerQuotas = new XmlDictionaryReaderQuotas();
readerQuotas.MaxStringContentLength = 65536;
readerQuotas.MaxArrayLength =65536;
basicHttpBinding.ReaderQuotas = readerQuotas;
using (this.gatewayProxy = new GatewayProxy.GatewayClient(basicHttpBinding, endPoint))
//write a code to call service function

Comments or Responses

Posted by: T.saravanan on: 10/12/2011 Level:Silver | Status: [Member] [MVP] | Points: 10

Kindly give an explanation about your code especially uses of GatewayProxy. Without explanation no one can understand your code.

Login to post response