I have implemented a windows servcice which is intended to start a business process in a scheduled manner. Once the buisiness process is started, it shouldn't be terminated by stopping the service. Hence I used the following OnStop
method:
protected override void OnStop()
{
/*
* Check, whether the business process is currently running;
*/
if (_sh.IsBusinessProcessRunning())
{
eventLog1.WriteEntry(String.Format(
"Stop instruction received! Service will be stopped, as soon the process '{0}' has completed. ",
ServiceHelper._businessExecutableName));
}
while (_sh.IsBusinessProcessRunning())
{
// Check each 30 seconds, whether the business process is still running
Thread.Sleep(30000);
}
eventLog1.WriteEntry("Service stopped!");
}
Actually this works fine, except that I'm getting the time out error dialog which may confuse the customer. Is there any way to modify the message within this dialog or to avoid it from getting displayed? (I would prefer to update the message, if possible)
Message:
The service "..." on "localhost" couldn't be terminated. The service did not respond to the start or control request in a timely fashion.