I have a service and a desktop controller in my application written in VB.Net. The controller starts, stops and does status inquiries on a regular basis. I have had problems with the controller starting the service and doing status inquiry on a 30 second basis and doing so successfully for varying amounts of time and then failing on the status inquiry function. The failure occurs after doing the same operaton successfully many times. The call is:
ServiceController.Refresh()MyTrace(, ServiceController.Status.ToString)
I get this error on the Status reference:
System.InvalidOperationException: Cannot open Cloud Print Service service on computer '.'. ---> System.ComponentModel.Win32Exception: The specified service does not exist as an installed service --- End of inner exception stack trace --- at System.ServiceProcess.ServiceController.GetServiceHandle(Int32 desiredAccess) at System.ServiceProcess.ServiceController.GenerateStatus() at System.ServiceProcess.ServiceController.get_Status()
This error would make sense on the first call to ServiceController functions if I had the wrong name or the service was not actually installed...but this happens after many calls to these functions. Also, why does the referesh succeed by the Status property fail. It makes no sense.