I have created a Worker Service and a Windows Form Application, the Form application functions as a way to check if the service is installer or not, if it's running or not running.
I attempted using the System.ServiceProcess.ServiceController class but when i'm using ServiceController i get the following error:
System.PlatformNotSupportedException: ServiceController enables manipulating and accessing Windows services and it is not applicable for other operating systems. at System.ServiceProcess.ServiceController..ctor(String name)
The error is reacting to the following code
return ServiceController.GetServices().Any(ServiceController =>
ServiceController.ServiceName.Equals(ServiceName));
I'm struggling to figure out how to solve this error, I'm still a beginner at C# and .NET so any suggestions would be appreciated. I have also attempted to install the System.ServiceProcess.ServiceController NuGet package but it didn't help.
Any suggestions?