Program.cs 1.42 KB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using PerformanceService;
using System.Configuration;

namespace ConsoleHostApp
{
    class Program
    {
        static void Main(string[] args)
        {
            // Start the EmailValidator Service
            Type serviceType = typeof(EmailValidator);
            string httpBindingAddress = ConfigurationManager.AppSettings["httpBindingAddress"];
            Uri serviceUri = new Uri(httpBindingAddress + "/EmailValidator"); 
            ServiceHost host = new ServiceHost(serviceType, serviceUri);
            host.Open();

            // Output some info...
            #region Output dispatchers listening 
            foreach (Uri uri in host.BaseAddresses) 
            {     
                Console.WriteLine("\t{0}", uri.ToString()); 
            }   
            Console.WriteLine(); 
            Console.WriteLine("Number of dispatchers listening : {0}", host.ChannelDispatchers.Count); 
            foreach (System.ServiceModel.Dispatcher.ChannelDispatcher dispatcher in host.ChannelDispatchers) 
            {     
                Console.WriteLine("\t{0}, {1}", dispatcher.Listener.Uri.ToString(), dispatcher.BindingName); 
            }   
            Console.WriteLine(); 
            Console.WriteLine("Press <ENTER> to terminate Host"); 
            Console.ReadLine(); 
            #endregion
        }
    }
}