// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; using System.Messaging; namespace RecvMSMQ { public class Program { private const string QNAME = @".\private$\TestQ"; public static void Main(string[] args) { using(MessageQueue q = new MessageQueue(QNAME)) { //q.Formatter = new ActiveXMessageFormatter(); // for COM (ASP) interoperabilitet q.Formatter = new BinaryMessageFormatter(); // for .NET interoperabilitet while(true) { Message rmsg = q.Receive(); string xml = (string)rmsg.Body; Console.WriteLine(xml); } } } } }