Example #1
0
 private void StartExternalSystemService()
 {
     try
     {
         externalSysHost = MonoscapeServiceHost.CreateHost(typeof(ExternalSystemService));
         var binding = MonoscapeServiceHost.GetBinding();
         externalSysHost.AddServiceEndpoint(typeof(IExternalSystemService), binding, Settings.ExternalSystemServiceURL);
         externalSysHost.Open();
         Console.WriteLine("External system service started at: " + Settings.ExternalSystemServiceURL);
     }
     catch (CommunicationException ex)
     {
         if (externalSysHost != null)
         {
             externalSysHost.Abort();
         }
         throw new MonoscapeException("Could not start service host: ExternalSystemService", ex);
     }
     catch (TimeoutException ex)
     {
         if (externalSysHost != null)
         {
             externalSysHost.Abort();
         }
         throw new MonoscapeException("Could not start service host: ExternalSystemService", ex);
     }
     catch (Exception)
     {
         if (externalSysHost != null)
         {
             externalSysHost.Abort();
         }
         throw;
     }
 }
Example #2
0
 private void StartDashboardService()
 {
     try
     {
         dashboardHost = MonoscapeServiceHost.CreateHost(typeof(CcDashboardService));
         var binding = MonoscapeServiceHost.GetBinding();
         dashboardHost.AddServiceEndpoint(typeof(ICcDashboardService), binding, Settings.DashboardServiceURL);
         dashboardHost.Open();
         Console.WriteLine("Dashboard service started at: " + Settings.DashboardServiceURL);
     }
     catch (CommunicationException ex)
     {
         if (dashboardHost != null)
         {
             dashboardHost.Abort();
         }
         throw new MonoscapeException("Could not start service host: CcDashboardService", ex);
     }
     catch (TimeoutException ex)
     {
         if (dashboardHost != null)
         {
             dashboardHost.Abort();
         }
         throw new MonoscapeException("Could not start service host: CcDashboardService", ex);
     }
     catch (Exception)
     {
         if (dashboardHost != null)
         {
             dashboardHost.Abort();
         }
         throw;
     }
 }
Example #3
0
 private void StartApplicationService()
 {
     try
     {
         applicationHost = MonoscapeServiceHost.CreateHost(typeof(ApplicationService));
         var binding = MonoscapeServiceHost.GetBinding();
         applicationHost.AddServiceEndpoint(typeof(IApplicationService), binding, Settings.ApplicationServiceURL);
         applicationHost.Open();
         Console.WriteLine("Application service started at: " + Settings.ApplicationServiceURL);
     }
     catch (CommunicationException ex)
     {
         if (applicationHost != null)
         {
             applicationHost.Abort();
         }
         throw new MonoscapeException("Could not start service host: ApplicationService", ex);
     }
     catch (TimeoutException ex)
     {
         if (applicationHost != null)
         {
             applicationHost.Abort();
         }
         throw new MonoscapeException("Could not start service host: ApplicationService", ex);
     }
     catch (Exception)
     {
         if (applicationHost != null)
         {
             applicationHost.Abort();
         }
         throw;
     }
 }
Example #4
0
        public static INcApplicationGridService GetNcApplicationGridService(Node node)
        {
            try
            {
                string serviceUrl    = node.ApplicationGridServiceUrl;
                string hostIpAddress = MonoscapeUtil.FindHostIpAddress().ToString();
                if (node.IpAddress.Equals(hostIpAddress) && (serviceUrl.Contains(node.IpAddress)))
                {
                    Log.Debug(typeof(EndPoints), "Node " + node.ToString() + " is running on the same host as the Application Grid");
                    serviceUrl.Replace(node.IpAddress, "localhost");
                }

                Log.Debug(typeof(EndPoints), "Creating INcApplicationGridService channel to node: " + serviceUrl);
                var binding = MonoscapeServiceHost.GetBinding();
                var address = new EndpointAddress(serviceUrl);
                ChannelFactory <INcApplicationGridService> factory = new ChannelFactory <INcApplicationGridService>(binding, address);
                INcApplicationGridService channel = factory.CreateChannel();
                return(channel);
            }
            catch (Exception e)
            {
                MonoscapeException me = new MonoscapeException("Could not connect to the node", e);
                Log.Error(typeof(EndPoints), me);
                throw me;
            }
        }
Example #5
0
        public static IApNodeControllerService GetApNodeControllerService()
        {
            var binding = MonoscapeServiceHost.GetBinding();
            var address = new EndpointAddress(Settings.ApplicationGridEndPointURL);
            ChannelFactory <IApNodeControllerService> factory = new ChannelFactory <IApNodeControllerService>(binding, address);
            IApNodeControllerService channel = factory.CreateChannel();

            return(channel);
        }
Example #6
0
 public IApDashboardService GetApDashboardService()
 {
     try
     {
         string serviceUrl = Settings.DashboardServiceURL;
         Log.Debug(typeof(EndPoints), "Creating IApDashboardService channel: " + serviceUrl);
         var binding = MonoscapeServiceHost.GetBinding();
         var address = new EndpointAddress(serviceUrl);
         ChannelFactory <IApDashboardService> factory = new ChannelFactory <IApDashboardService>(binding, address);
         IApDashboardService channel = factory.CreateChannel();
         return(channel);
     }
     catch (Exception e)
     {
         MonoscapeException me = new MonoscapeException("Could not connect to the Load Balancer", e);
         Log.Error(typeof(EndPoints), me);
         throw me;
     }
 }
Example #7
0
 private void StartApplicationGridService()
 {
     try
     {
         if (gridServiceHost == null)
         {
             gridServiceHost = MonoscapeServiceHost.CreateHost(typeof(LbApplicationGridService));
             var binding = MonoscapeServiceHost.GetBinding();
             gridServiceHost.AddServiceEndpoint(typeof(ILbApplicationGridService), binding, Settings.LbApplicationGridServiceURL);
             gridServiceHost.Open();
             Console.WriteLine("Application Grid service started at: " + Settings.LbApplicationGridServiceURL);
         }
     }
     catch (AddressAlreadyInUseException)
     {
     }
     catch (CommunicationException ex)
     {
         if (gridServiceHost != null)
         {
             gridServiceHost.Abort();
         }
         throw new MonoscapeException("Could not start service host: LbApplicationGridService", ex);
     }
     catch (TimeoutException ex)
     {
         if (gridServiceHost != null)
         {
             gridServiceHost.Abort();
         }
         throw new MonoscapeException("Could not start service host: LbApplicationGridService", ex);
     }
     catch (Exception)
     {
         if (gridServiceHost != null)
         {
             gridServiceHost.Abort();
         }
         throw;
     }
 }