private static int GetServicePort(string address) { var binding = CreateBinding(TimeSpan.MaxValue); var endPointAddress = new EndpointAddress($"net.tcp://{AddressUtility.ConnectionAddress(address)}/DescriptorService"); var serviceClient = new DescriptorServiceClient(binding, endPointAddress); try { var serviceInfos = serviceClient.GetServiceInfos(); foreach (var item in serviceInfos) { if (item.Name == nameof(RuntimeService)) { return(item.Port); } } throw new InvalidOperationException(); } finally { serviceClient.Close(); } }
public static DescriptorServiceClient CreateServiceClient(string address) { var binding = CremaHost.CreateBinding(ServiceInfo.Empty); var endPointAddress = new EndpointAddress(string.Format("net.tcp://{0}/DescriptorService", AddressUtility.ConnectionAddress(address))); var serviceClient = new DescriptorServiceClient(binding, endPointAddress); return(serviceClient); }
public static DescriptorServiceClient CreateServiceClient(string address) { var binding = CreateBinding(TimeSpan.MaxValue); var endPointAddress = new EndpointAddress($"net.tcp://{AddressUtility.ConnectionAddress(address)}/DescriptorService"); var serviceClient = new DescriptorServiceClient(binding, endPointAddress); return(serviceClient); }