The queue does not exist or you do not have sufficient permissions to perform the operation.
at System.Messaging.MessageQueue.Resolv eFormatNam eFromQueue Path(Strin g queuePath, Boolean throwException)
at System.Messaging.MessageQueue.get_Fo rmatName()
at System.Messaging.MessageQueue.SendIn ternal(Obj ect obj, MessageQueueTransaction internalTransaction, MessageQueueTransactionTyp e transactionType)
at System.Messaging.MessageQueue.Send(O bject obj)
private static string queueName = @".\test_queue";
static void Main(string[] args)
{
try
{
MessageQueue msgQ = new MessageQueue(queueName);
string sMessage = "Test MSMQ Message 2";
msgQ.Send(sMessage.Trim());
System.Messaging.Message[] MSMQMessages = msgQ.GetAllMessages();
foreach (System.Messaging.Message msg in MSMQMessages)
{
byte[] data = new byte[1024];
msg.BodyStream.Read(data, 0, 1024);
string strMessage = ASCIIEncoding.ASCII.GetString(data);
Console.WriteLine(strMessage.Trim());
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.