using System; using System.ServiceModel; namespace DistributedGA.ContactServer.Host { class Program { static void Main(string[] args) { string baseAddress = string.Empty; if (args.GetUpperBound(0) > -1) { baseAddress = args[0]; } if (string.IsNullOrWhiteSpace(baseAddress)) { baseAddress = "net.tcp://localhost:9090/DistributedGA.ContactServer/ContactService"; } using (ServiceHost host = new ServiceHost(typeof(ContactServiceImpl), new Uri[] { new Uri(baseAddress) })) { // Enable metadata publishing. // Open the ServiceHost to start listening for messages. Since // no endpoints are explicitly configured, the runtime will create // one endpoint per base address for each service contract implemented // by the service. host.Open(); Console.WriteLine("The service is ready at {0}", baseAddress); Console.WriteLine("Press to stop the service."); Console.ReadLine(); // Close the ServiceHost. host.Close(); } } } }