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); }
private void SubscribeToApplicationGrid() { try { Console.WriteLine("Subscribing to Application Grid at: " + Settings.ApplicationGridEndPointURL); MonoscapeCredentials credentials = new MonoscapeCredentials(Settings.MonoscapeAccessKey, Settings.MonoscapeSecretKey); ApSubscribeNodeRequest request = new ApSubscribeNodeRequest(credentials); IPAddress hostIp = MonoscapeUtil.FindHostIpAddress(); request.IpAddress = hostIp.ToString(); request.IpAddress_ = hostIp; request.ApplicationGridServiceUrl = Settings.ApplicationGridServiceUrl; request.FileTransferServiceUrl = Settings.FileServerServiceUrl + "/wsHttp"; IApNodeControllerService channel = EndPoints.GetApNodeControllerService(); ApSubscribeNodeResponse response = channel.SubscribeNode(request); Database.Node = response.Node; Console.WriteLine("Subscribed successfully"); } catch (EndpointNotFoundException e) { throw new MonoscapeException("Could not connect to the Application Grid", e); } }