public int GetInt(int Num) { Console.WriteLine(Num); Uri tcpUri = new Uri("http://localhost:8001/MyService"); EndpointAddress address = new EndpointAddress(tcpUri); BasicHttpBinding binding = new BasicHttpBinding(); ChannelFactory <IMyService> factory = new ChannelFactory <IMyService>(binding, address); IMyService service = factory.CreateChannel(); while (Num > 1) { Num = service.GetInt(Num - 1); } Console.WriteLine(); if (Num == 1) { service.GetInt(Num - 1); } return(0); }
static void Main(string[] args) { Uri tcpUri = new Uri("http://localhost:8000/MyService"); EndpointAddress address = new EndpointAddress(tcpUri); BasicHttpBinding binding = new BasicHttpBinding(); ChannelFactory <IMyService> factory = new ChannelFactory <IMyService>(binding, address); IMyService service = factory.CreateChannel(); Console.WriteLine(service.GetInt(int.Parse(Console.ReadLine()))); Console.ReadLine(); }