Exemplo n.º 1
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;
            }
        }
Exemplo n.º 2
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;
     }
 }