/// <summary> /// Program entry point /// </summary> static int Main(string[] args) { if (0 == args.Length) { return(Syntax()); } var host_name = args[0]; if (string.IsNullOrEmpty(host_name)) { return(Syntax()); } var message = $"Hello from {Environment.MachineName}!"; IEchoService channel = null; try { var binding = new BasicHttpBinding(); var uri = $"http://{host_name}:80/echo/basic"; var endpoint = new EndpointAddress(uri); var factory = new ChannelFactory <IEchoService>(binding, endpoint); channel = factory.CreateChannel(); // This works on Windows and Mac var rc = channel.Echo1(message); Console.WriteLine(rc); // This works on Windows and Mac rc = channel.Echo2(message); Console.WriteLine(rc); // This works on Windows and Mac //rc = channel.Echo1(""); //Console.WriteLine(rc); // This works on Windows // This does not work on Mac rc = channel.Echo2(""); Console.WriteLine(rc); } catch (FaultException ex) { Console.WriteLine(FaultExceptionMessage(ex)); } catch (CommunicationException ex) { Console.WriteLine(ex); } catch (TimeoutException ex) { Console.WriteLine(ex); } catch (Exception ex) { Console.WriteLine(ex); } if (null != channel) { (channel as ICommunicationObject).Close(); } Console.WriteLine(); Console.WriteLine("Press <ENTER> to continue."); Console.WriteLine(); Console.ReadLine(); return(0); }