Receiving MSMQ messages with Windows Service
问题 I'm creating a Windows Service in C#. What is the best way to listen for messages?? How do I code this properly?? 回答1: You don't listen. You configure MSMQ Activation to activate your component when messages arrive. The link has all the details you need, code and configuration. 回答2: As previously stated, MSMQ Activation is probably the best way, if you can use that. Alternatively, here is code that I've used: var ts = new TimeSpan(0, 0, 10); MessageQueue q = GetQueue<T>(); while (true) { try