For the majority cases, it is pretty obvious that you don’t have the required security permission to access a particular message queue if you get the MSMQ “Access to Message Queuing system is denied” exception on accessing a private queue.
Security information for the private queues are managed in the same way as files and folders in Windows:
- Browse to your private queues in the management console (Start -> type “computer management” and enter -> Services and Applications -> Message Queuing -> Private Queues).
- Right click on the target queue for it’s Properties, you’ll see the same security tab in the popping up window.
- Here you can assign property permissions to the user/group that your application runs on.
- If this is for debugging or testing purpose and you are not who/which group to assign the permission to, you may try giving Full Control to “Everyone”.
If you do not have the permission to modify the security setting of this queue, then this queue was probably not created by you.
The first thing you need to do is to take over the ownership by going to Advanced -> Owner -> select or find your user/group -> OK. This requires that you have permission to take owner ship from another user, and it usually means that you need to be and administrative user first.
Once you have taken the owner ship, you then can modify the security settings for this queue without problems.
What happens if the above did’t work
There’s another trick that you can try here.
Usually the meta data of these queues are stored at C:\Windows\System32\msmq\storage\lqs. If you use any text editor to open files in this folder, you’ll see the details of the queues. By default, the Administrator group and the MSMQ system account has full control on these files, so if you are an administrative user, you should be able to modify these files (otherwise, try taking ownership of these files see if that works).
- First, you need to stop the MSMQ service.
- Then locate the queue file that you are having problem with, the Security attribute is the one we need to modify.
- If you need a working value for this attribute, you can create a new private queue in the management console and copy the security value in this new queue to your target queue.
- Now start the MSMQ service and hopefully this works :P