How to know programmatically whether Message Queueing is enabled on the machine or not?

前端 未结 4 1286
情深已故
情深已故 2021-02-20 15:18

I know that when I try to create new MessageQueue, system throws InvalidOperationException if the Message Queuing is not enabled.

But how to k

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-20 16:01

    You have answered your own question there: try to create a new MessageQueue, and catch InvalidOperationException.

    If you don't get an exception, MQ is enabled; if you get an exception, it's not enabled. (you may dispose of that MessageQueue instance if one was created, as you've only used it for detecting support)

提交回复
热议问题