/// <summary>
        ///
        /// </summary>
        /// <param name="includeMercurialServer">During tests that don't actually involve send/receive/clone, you can speed things
        /// up by setting this to false</param>
        public bool Start(bool includeMercurialServer)
        {
            try
            {
                if (includeMercurialServer)
                {
                    _hgServer = new HgServeRunner(ChorusHubOptions.RootDirectory, ChorusHubOptions.MercurialPort);
                    if (!_hgServer.Start())
                        return false;
                }
                _advertiser = new Advertiser(ChorusHubOptions.AdvertisingPort);
                _advertiser.Start();

                //gave security error _serviceHost = new ServiceHost(this);
                _serviceHost = new ServiceHost(typeof(ChorusHubService));

               EnableSendingExceptionsToClient();

                var address = "net.tcp://localhost:" + ServicePort;
                var binding = new NetTcpBinding
                {
                    Security = {Mode = SecurityMode.None}
                };
                _serviceHost.AddServiceEndpoint(typeof(IChorusHubService), binding, address);
                //EventLog.WriteEntry("Application", string.Format("Starting extra chorus hub services on {0}", address), EventLogEntryType.Information);
                _serviceHost.Open();
                return true;
            }
            catch (Exception error)
            {
                //EventLog.WriteEntry("Application", error.Message, EventLogEntryType.Error);
                return false;
            }
        }
Beispiel #2
0
        public void Stop()
        {
            if (_advertiser != null)
            {
                _advertiser.Stop();
                _advertiser = null;
            }
            if (_hgServer != null)
            {
                _hgServer.Stop();
                _hgServer = null;
            }

            if (_serviceHost == null)
            {
                return;
            }

            _serviceHost.Close();
            _serviceHost = null;
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="includeMercurialServer">During tests that don't actually involve send/receive/clone, you can speed things
        /// up by setting this to false</param>
        public bool Start(bool includeMercurialServer)
        {
            try
            {
                if (includeMercurialServer)
                {
                    _hgServer = new HgServeRunner(ChorusHubOptions.RootDirectory, ChorusHubOptions.MercurialPort);
                    if (!_hgServer.Start())
                    {
                        EventLog.WriteEntry("ChorusHub", "Failed to start Hg Server", EventLogEntryType.Error);
                        return(false);
                    }
                }
                _advertiser = new Advertiser(ChorusHubOptions.AdvertisingPort);
                _advertiser.Start();

                //gave security error _serviceHost = new ServiceHost(this);
                _serviceHost = new ServiceHost(typeof(ChorusHubService));

                EnableSendingExceptionsToClient();

                var address = "net.tcp://localhost:" + ServicePort;
                var binding = new NetTcpBinding
                {
                    Security = { Mode = SecurityMode.None }
                };
                _serviceHost.AddServiceEndpoint(typeof(IChorusHubService), binding, address);
                //EventLog.WriteEntry("Application", string.Format("Starting extra chorus hub services on {0}", address), EventLogEntryType.Information);
                _serviceHost.Open();
                return(true);
            }
            catch (Exception error)
            {
                var logEntryMessage = string.Format("ChorusHub failed to start: {0}{1}{2}{1}{3}", error.Message, Environment.NewLine,
                                                    error.StackTrace, error.InnerException);
                EventLog.WriteEntry("ChorusHub", logEntryMessage, EventLogEntryType.Error);
                return(false);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="includeMercurialServer">During tests that don't actually involve send/receive/clone, you can speed things
        /// up by setting this to false</param>
        public bool Start(bool includeMercurialServer)
        {
            ChorusHubServiceImplementation.Progress = Progress;

            try
            {
                if (includeMercurialServer)
                {
                    _hgServer = new HgServeRunner(Parameters.RootDirectory, ChorusHubParameters.kMercurialPort) { Progress = Progress };
                    if (!_hgServer.Start())
                        return false;
                }
                _advertiser = new Advertiser(ChorusHubParameters.kAdvertisingPort) { Progress = Progress };
                _advertiser.Start();

                //gave security error _serviceHost = new ServiceHost(this);
                _serviceHost = new ServiceHost(typeof(ChorusHubServiceImplementation));

               EnableSendingExceptionsToClient();

                string address = "net.tcp://localhost:" + ServicePort.ToString();
                var binding = new NetTcpBinding();
                binding.Security.Mode = SecurityMode.None;
                _serviceHost.AddServiceEndpoint(typeof(IChorusHubService), binding, address);
                Progress.WriteVerbose("Starting extra chorus hub services on {0}", address);
                _serviceHost.Open();
                return true;
            }
            catch (Exception error)
            {
                Progress.WriteException(error);
                return false;
            }
        }
Beispiel #5
0
        public void Stop()
        {
            if (_advertiser != null)
            {
                _advertiser.Stop();
                _advertiser = null;
            }
            if (_hgServer != null)
            {
                _hgServer.Stop();
                _hgServer = null;
            }

            if(_serviceHost!=null)
            {
                _serviceHost.Close();
                _serviceHost = null;
            }
        }