Exemplo n.º 1
0
        public ListenerServiceHost(int overridePortNumber, bool requireSecureConnection, bool useCrossDomainService, bool useServiceConfiguration)
        {
            int listenerPort = overridePortNumber == 0 ? DataphorServiceUtility.DefaultListenerPortNumber : overridePortNumber;

            _listenerHost = useServiceConfiguration ? new CustomServiceHost(typeof(ListenerService)) : new ServiceHost(typeof(ListenerService));

            if (!useServiceConfiguration)
            {
                _listenerHost.AddServiceEndpoint
                (
                    typeof(IListenerService),
                    DataphorServiceUtility.GetBinding(),
                    DataphorServiceUtility.BuildListenerURI(Environment.MachineName, listenerPort)
                );
            }

            try
            {
                _listenerHost.Open();
            }
            catch
            {
                // An error indicates the service could not be started because there is already a listener running in another process.
            }
        }
Exemplo n.º 2
0
 public ListenerClient(string hostName, int overridePortNumber) : base(new Uri(DataphorServiceUtility.BuildListenerURI(hostName, overridePortNumber)))
 {
     _hostName = hostName;
 }