using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using HelloWorldLib;
using System.ServiceModel.Description;

namespace ConsoleHost
{
    class Program
    {
        static void Main(string[] args)
        {
            // create and open ServiceHost with base addresses
            ServiceHost host = new ServiceHost(
                typeof(HelloWorldService),
                new Uri("http://localhost:8080/hello"),
                new Uri("net.tcp://localhost:8081/hello"),
                new Uri("net.pipe://localhost/hello"));
            host.Open();

            // print all the exposed endpoints
            Console.WriteLine("{0} is up and running with the following endpoints:",
                host.Description.ServiceType);
            foreach (ServiceEndpoint se in host.Description.Endpoints)
                Console.WriteLine("{0}: {1}", se.Binding.Name, se.Address);

            // keep the process running
            Console.ReadLine();
            host.Close();
        }
    }
}
