Beispiel #1
0
        private void StopServiceHost()
        {
            try
            {
                if (this.host != null)
                {
                    if (this.host.State == CommunicationState.Faulted)
                    {
                        this.host.Abort();
                    }
                    else
                    {
                        this.host.Close();
                    }

                    this.host = null;
                }
            }
            finally
            {
                if (this.service != null)
                {
                    this.service.Dispose();
                    this.service = null;
                }
            }
        }
Beispiel #2
0
        protected override void OnStart(string[] args)
        {
            StopServiceHost();

            this.service = new FanControlService();
            this.host    = new ServiceHost(service);
            this.host.Open();
        }
Beispiel #3
0
        protected override void OnStart(string[] args)
        {
            logger.Info("Starting NoteBookFanControlService");
            StopServiceHost();

            this.service = new FanControlService();
            this.host    = new ServiceHost(service);
            this.host.Open();
        }