We have a public queue called .\publicQueue Error.
MessageQueue currentQueue = new MessageQueue(queue);
AccessControlList accessList = new AccessControlList();
Trustee queueOwner = new Trustee(user, Environment.MachineName, TrusteeType.User);
MessageQueueAccessControlEntry accessOwner = new MessageQueueAccessControlEntry(queueOwner, rights);
accessList.Add(accessOwner);
currentQueue.SetPermissions(accessList);
After executing the code I am presented with the following error: System.Messaging.MessageQueueException (0x80004005): Access to Message Queuing system is denied.
I can confirm that the queue does exist.
Any ideas of what might be wrong here?
I have found a suggestion saying that anonymous app pool creds can cause the issue, but this is not the case. The app pool is executing as the same user used as queueowner in the code.