private string GetInstanceURI(string hostName, string instanceName, bool useNative) { try { if (String.IsNullOrEmpty(instanceName)) { throw new FaultException <ListenerFault>(new ListenerFault(), "Instance name is empty. An instance name is required"); } ServerConfiguration server = GetConfiguration().Instances[instanceName]; if (server == null) { throw new FaultException <ListenerFault>(new ListenerFault(), String.Format("Instance Name {0} not found", instanceName)); } if (useNative) { return(DataphorServiceUtility.BuildNativeInstanceURI(hostName, server.PortNumber, server.Name)); } return(DataphorServiceUtility.BuildInstanceURI(hostName, server.PortNumber, server.Name)); } catch (Exception exception) { throw new FaultException <ListenerFault>(ListenerFaultUtility.ExceptionToFault(exception), exception.Message); } }
public string GetNativeInstanceURI(string instanceName) { try { var channel = GetInterface(); IAsyncResult result = channel.BeginGetNativeInstanceURI(_hostName, instanceName, null, null); result.AsyncWaitHandle.WaitOne(); return(channel.EndGetNativeInstanceURI(result)); } catch (FaultException <ListenerFault> exception) { throw ListenerFaultUtility.FaultToException(exception.Detail); } }
public string[] EnumerateInstances() { try { var channel = GetInterface(); IAsyncResult result = channel.BeginEnumerateInstances(null, null); result.AsyncWaitHandle.WaitOne(); return(channel.EndEnumerateInstances(result)); } catch (FaultException <ListenerFault> exception) { throw ListenerFaultUtility.FaultToException(exception.Detail); } }
public string[] EnumerateInstances() { try { InstanceConfiguration configuration = GetConfiguration(); string[] result = new string[configuration.Instances.Count]; for (int index = 0; index < configuration.Instances.Count; index++) { result[index] = configuration.Instances[index].Name; } return(result); } catch (Exception exception) { throw new FaultException <ListenerFault>(ListenerFaultUtility.ExceptionToFault(exception), exception.Message); } }