MSMQ COM API in C#

2019-01-23 17:10发布

What is the best way to use MSMQManagement from C#? I need the ability to peek and purge a local outgoing queue when the remote machine is disconnected.

Apparently some users can do this through the COM API, but in the COM References tab, I don't have the "Microsoft Message Queue 3.0 Object Library" that other websites/blogs/postings mention (nor anything remotely similar). I've searched the machine for Interop.MSMQ.dll and cannot find it either.

We are using VS 2008 and running on Windows 7 64-bit.

What am I missing? Are there other mechanisms to accomplish this through "normal" managed classes?

Thanks

标签: c# com msmq
2条回答
唯我独甜
2楼-- · 2019-01-23 17:42

Project + Add Reference, Browse tab. Navigate to c:\windows\system32 (or syswow64 on a 64-bit operating system) and select mqoa30.tlb. This creates the Interop.MSMQ.dll interop assembly you are looking for. Beware that MSMQ is an optional Windows component, you'll need to install it first if the file isn't present on your machine.

查看更多
做自己的国王
3楼-- · 2019-01-23 17:50

you can use it natively from .NET by using: System.Messaging.MessageQueue

check these articles:

Accessing Message Queues

Reliable Messaging with MSMQ and .NET

查看更多
登录 后发表回答