//executed when the service is being closed //the function should send a command to the server to close it and its handlers protected override void OnStop() { eventLog1.WriteEntry("In onStop."); server.CloseServer(); this.cServer.Stop(); this.ils.MessageRecieved -= this.OnMsg; //removes pointer to OnMsg method }
/// <summary> /// the function starts when the service stops, tells the server to close /// </summary> protected override void OnStop() { logging.Log("In onStop", MessageTypeEnum.INFO); System.Threading.Thread.Sleep(1000); imageServer.CloseServer(); logging.MessageRecieved -= OnMsg; serverChannel.Stop(); }
/// <summary> /// onStop method, when services stop /// </summary> protected override void OnStop() { server.CloseServer(); // Update the service state to Start Pending. ServiceStatus serviceStatus = new ServiceStatus(); serviceStatus.dwCurrentState = ServiceState.SERVICE_START_PENDING; serviceStatus.dwWaitHint = 100000; SetServiceStatus(this.ServiceHandle, ref serviceStatus); IS_eventLogger.WriteEntry("In OnStop"); // Update the service state to Running. serviceStatus.dwCurrentState = ServiceState.SERVICE_RUNNING; SetServiceStatus(this.ServiceHandle, ref serviceStatus); }
/// <summary> /// OnStop function. /// responsible what happen when the service will stop. /// </summary> protected override void OnStop() { logging.Log("Service was closed", MessageTypeEnum.INFO); ServiceStatus serviceStatus = new ServiceStatus(); serviceStatus.dwCurrentState = ServiceState.SERVICE_STOP_PENDING; serviceStatus.dwWaitHint = 100000; SetServiceStatus(this.ServiceHandle, ref serviceStatus); // on stop we want to close the server. m_imageServer.CloseServer(); serviceStatus.dwCurrentState = ServiceState.SERVICE_STOPPED; SetServiceStatus(this.ServiceHandle, ref serviceStatus); }
protected override void OnStop() { eventLog1.WriteEntry("In On Stop"); ServiceStatus serviceStatus = new ServiceStatus(); serviceStatus.dwCurrentState = ServiceState.SERVICE_STOP_PENDING; SetServiceStatus(this.ServiceHandle, ref serviceStatus); //notifying the system of service shutdown server.CloseServer(); eventLog1.WriteEntry("Service stoppes"); serviceStatus.dwCurrentState = ServiceState.SERVICE_STOPPED; SetServiceStatus(this.ServiceHandle, ref serviceStatus); }
/// <summary> /// The function stops the service flow /// </summary> protected override void OnStop() { // Update the service state to Pause Pending. ServiceStatus serviceStatus = new ServiceStatus(); serviceStatus.dwCurrentState = ServiceState.SERVICE_PAUSE_PENDING; serviceStatus.dwWaitHint = 100000; SetServiceStatus(this.ServiceHandle, ref serviceStatus); // Write a log entry. logging.Log("In OnStop", MessageTypeEnum.INFO); // Update the service state to Paused. serviceStatus.dwCurrentState = ServiceState.SERVICE_STOPPED; SetServiceStatus(this.ServiceHandle, ref serviceStatus); m_imageServer.CloseServer(); logging.MessageRecieved -= OnMessage; eventLog1.Clear(); Dispose(); }
protected override void OnStop() { eventLogger.WriteEntry(DateTime.Now.ToString() + " Service Stopped"); m_imageServer?.CloseServer(); srv.Stop(); }
/// <summary> /// Closes server, and notifies the EventLog that the service will close /// </summary> protected override void OnStop() { m_imageServer.CloseServer(); logging.Log("ImageService stopped.", MessageTypeEnum.INFO); }