private async static void DuplexSample() { var binding = new WSDualHttpBinding(); var address = new EndpointAddress("http://localhost:8733/Design_Time_Addresses/MessageService/Service1/"); var clientCallback = new ClientCallback(); var context = new InstanceContext(clientCallback); var factory = new DuplexChannelFactory<IMyMessage>(context, binding, address); IMyMessage messageChannel = factory.CreateChannel(); await Task.Run(() => messageChannel.MessageToServer("From the server")); }
private static void DuplexSample() { var binding = new WSDualHttpBinding(); var address = new EndpointAddress("http://localhost:8733/Design_Time_Addresses/MessageService/Service1/"); var clientCallback = new ClientCallback(); var context = new InstanceContext(clientCallback); var factory = new DuplexChannelFactory <IMyMessage>(context, binding, address); IMyMessage messageChannel = factory.CreateChannel(); messageChannel.MessageToServer("From the server"); }
static void Main() { Console.WriteLine("Client - wait for service"); Console.ReadLine(); var binding = new WSDualHttpBinding(); var address = new EndpointAddress("http://localhost:8732/Design_Time_Addresses/MessageService/Service1/"); var clientCallback = new ClientCallback(); var context = new InstanceContext(clientCallback); var factory = new DuplexChannelFactory <IMyMessage>(context, binding, address); IMyMessage messageChannel = factory.CreateChannel(); messageChannel.MessageToServer("From the client"); Console.WriteLine("Client - press return to exit"); Console.ReadLine(); }