I am doing a C# Net Core 2.0 Application
. I need to execute a Windows Service
, but before I need to check if it is running.
I saw in this post that the best way is using ServiceController
like this
try
{
using( ServiceController sc = new ServiceController( SERVICE_NAME ) )
{
return sc.Status == ServiceControllerStatus.Running;
}
}
But I do not find it in Net core 2.0
How can I checked it ?