public static void StopService(string servicName)
{
try
{
ServiceController service = new ServiceController(servicName);
service.Stop();
service.WaitForStatus(ServiceControllerStatus.Stopped);
}
catch (Exception ex)
{
_logger.Error("StopService", ex);
}
}
How to stop running service
Dani_S
3,786
Reputation points
Hi,
I have worker service that run quartz sceduler.
The question regard to service.
When quartz sceduler is running and for example there is no space in disk i want to stop the service.
Is it possible if yes please give sample code ?
Thanks,
1 answer
Sort by: Most helpful
-
Dani_S 3,786 Reputation points
2024-04-08T10:58:57.87+00:00