I know that when I try to create new MessageQueue
, system throws InvalidOperationException
if the Message Queuing is not enabled.
But how to k
You can use the System.ServiceProcess for this one, but first you need to add reference to your project the Service.ServiceProcess
, and you can retrieve all the services and get their status like this:
List services = ServiceController.GetServices().ToList();
ServiceController msQue = services.Find(o => o.ServiceName == "MSMQ");
if (msQue != null) {
if (msQue.Status == ServiceControllerStatus.Running) {
// It is running.
}
} else { // Not installed? }