anil kumar

anil kumar

  • NA
  • 23
  • 4.5k

WCF service Contract

Sep 1 2016 4:55 PM
hi,
please could anyone provide the correct answer for the question. 
 
If "IService1" is a contract,
public interface IService1
{
   [operationContract] 
   string GetData(int value); 
} then at the client side followoing is the piece of code to obtin the proxyObject, to call the service .
string url = "htt://localhost:26800/service1.svc?wsdl";
EndPointAddress endPoint = new EndPointAddress (url); 
BasicHttpBinding binding = new  BasicHttpBinding(); 
----------------------------------------------------------------------------------
 Console.WriteLine (ref, GetData(100)) ;
 
Options : 
 
1. IService1 lref = new ChannelFactory <IService1> (endPoint), CreateChannel(); 
2. IService1 lref = new ChannelFactory <IService1> (binding, endPoint), CreateChannel();
3. IService1 lref = new ChannelFactory <IService1> (binding), CreateChannel(); 
4.  IService1 lref = new ChannelFactory <IService1> (), CreateChannel();
 

Answers (5)