(Shell D00d)
7/22/2004 2:10:00 AM
"pl_dave" <pldave@discussions.microsoft.com> wrote in message news:<7441DEF7-3F88-4257-9971-8121E7BBAEA4@microsoft.com>...
> the problem was that the queue was created by a service that i wrote. since that service was not running under my account, i was not the creator of the queue. even as administrator, i didn't have authority to read or delete the queue. so to solve the problem, i made the service delete the queue and then recreated it by using the computer management console. now it's all working fine.
Hi,
I've just posted code that allows the current user to access the
queue. However, I posted it under your previous post as I hadn't seen
this one! (silly me). Here it is again, anyway:
using System.Messaging;
AccessControlList acl = new AccessControlList();
Trustee trustee = new Trustee("SYSTEM", Environment.MachineName,
System.Messaging.TrusteeType.Group);
Trustee owner = new Trustee(System.Security.Principal.WindowsIdentity.GetCurrent().Name,
Environment.MachineName, System.Messaging.TrusteeType.User);
MessageQueueAccessControlEntry aceSystem = new
System.Messaging.MessageQueueAccessControlEntry(trustee,
System.Messaging.MessageQueueAccessRights.FullControl);
MessageQueueAccessControlEntry aceOwner = new
System.Messaging.MessageQueueAccessControlEntry(owner,
System.Messaging.MessageQueueAccessRights.FullControl);
acl.Add(aceSystem);
acl.Add(aceOwner);
myQueue.Permissions = acl;