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

namespace GeometryServiceHost.InlineConfiguration
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("GeometryServiceHost starting");
            Uri baseAddr = new Uri("http://localhost:8733/Design_Time_Addresses/GeometryServiceLibrary/GeometryService/");
            using (ServiceHost host = new ServiceHost(typeof(GeometryService), baseAddr))
            {
                //Add Endpoint
                host.AddServiceEndpoint(typeof(IGeometryService), new WSHttpBinding(), baseAddr);

                //Enable MEX
                ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
                smb.HttpGetEnabled = true;
                smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
                host.Description.Behaviors.Add(smb);

                //run host
                host.Open();
                Console.WriteLine("GeometryServiceHost started. Press enter to stop.");
                Console.ReadLine();
            }

            Console.WriteLine("GeometryServiceHost stopped");
            Console.ReadLine();
        }
    }
}
