static void HandleDomainUnload(object sender, EventArgs e)
        {
            ServiceHost.Cancellation.Cancel();

            ServiceHost = null;

            AppDomain.CurrentDomain.DomainUnload -= HandleDomainUnload;
        }
        static DataServiceHostSetup()
        {
            AppDomain.CurrentDomain.DomainUnload += HandleDomainUnload;

            Console.WriteLine(@"Starting ProductDataServiceHost.");

            ServiceHost = new ProductDataServiceHost(BaseUri);

            while (!ServiceHost.Active)
            {
                if(ServiceHost.Failed)
                {
                    Console.WriteLine(@"ProductDataServiceHost failed to start.");
                    return;
                }

                Thread.Sleep(100);
            }

            Console.WriteLine(@"ProductDataServiceHost started.");
        }