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);
}
}
ASKER
Windows Server 2003 was based on Windows XP and was released in four editions: Web, Standard, Enterprise and Datacenter. It also had derivative versions for clusters, storage and Microsoft’s Small Business Server. Important upgrades included integrating Internet Information Services (IIS), improvements to Active Directory (AD) and Group Policy (GP), and the migration to Automated System Recovery (ASR).
TRUSTED BY
Verify that you have a Public Queue named test_queue in Computer Management -> Services and Applications -> Message Queuing -> Public Queues
Open in new window
Produces the following output for me -