Esempio n. 1
0
        private static void HostServices()
        {
            List <ServiceHost>    lHosts = new List <ServiceHost>();
            SubscriberServiceHost sHost  = new SubscriberServiceHost(typeof(SubscriberService), cAddress, cMexAddress, true, queue_dir);

            try
            {
                Configuration            lAppConfig    = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                ServiceModelSectionGroup lServiceModel = ServiceModelSectionGroup.GetSectionGroup(lAppConfig);

                System.ServiceModel.Configuration.ServicesSection lServices = lServiceModel.Services;
                foreach (ServiceElement lServiceElement in lServices.Services)
                {
                    ServiceHost lHost = new ServiceHost(Type.GetType(GetAssemblyQualifiedServiceName(lServiceElement.Name)));
                    lHost.Open();
                    lHosts.Add(lHost);
                }
                Console.WriteLine("VideoStore Service Started, press Q key to quit");
                while (Console.ReadKey().Key != ConsoleKey.Q)
                {
                    ;
                }
            }
            finally
            {
                sHost.Dispose();
                foreach (ServiceHost lHost in lHosts)
                {
                    lHost.Close();
                }
            }
        }
Esempio n. 2
0
 private static void HostServices()
 {
     //using (ServiceHost lHost = new ServiceHost(typeof(TransferService)))
     //{
     //    lHost.Open();
     //    Console.WriteLine("Bank Services started. Press Q to quit.");
     //    while (Console.ReadKey().Key != ConsoleKey.Q) ;
     //}
     using (SubscriberServiceHost lHost = new SubscriberServiceHost(typeof(SubscriberService), cAddress, cMexAddress, true, queue_dir))
     {
         Console.WriteLine("Bank Services started. Press Q to quit.");
         while (Console.ReadKey().Key != ConsoleKey.Q)
         {
             ;
         }
         lHost.Dispose();
     }
 }
Esempio n. 3
0
 static void Main(string[] args)
 {
     ResolveDependencies();
     //using (ServiceHost lHost = new ServiceHost(typeof(DeliveryService)))
     //{
     //    lHost.Open();
     //    Console.WriteLine("Delivery Service started. Press Q to quit");
     //    while (Console.ReadKey().Key != ConsoleKey.Q) ;
     //}
     using (SubscriberServiceHost lHost = new SubscriberServiceHost(typeof(SubscriberService), cAddress, cMexAddress, true, queue_dir))
     {
         Console.WriteLine("Delivery Service started. Press Q to quit");
         while (Console.ReadKey().Key != ConsoleKey.Q)
         {
             ;
         }
         lHost.Dispose();
     }
 }