tags:

views:

3463

answers:

5

On an XP machine there is a private messagequeue that was created by a .net service. When I want to access this private queue in a VB6 application I keep getting an "Access is denied" error. So it seems this is a security issue, only I don't understand why even when I am logged on as an administrator I still can't have access to queue that was created on the same machine. Is there something else I have to take into account.

Sample on how I use the queue in VB6

Public msgQueue As MSMQQueue

Private Sub OpenQueue()

    Dim MQ As New MSMQQueueInfo
        MQ .PathName = ".\Private$\incommingQueue"

    Set msgQueue = MQ.Open(MQ_RECEIVE_ACCESS, MQ_DENY_NONE)

End Sub
+15  A: 

This can happen if the .NET Service removed the "Everyone" group from the permissions the private queue. Here are some steps you can take to resolve this:

  1. Stop the MSMQ Service

  2. Open the folder C:\WINDOWS\system32\msmq\storage\lqs

  3. Find the file in this folder that describes your queue -- (incommingQueue)

  4. Using notepad, open the lqs file for some other private queue that has good security permissions. (If you don't have any other private queues create one)

  5. Locate the line in the file that begins Security=....

  6. Copy the whole line to your clipboard (watch out for Word Wrap, this line will be quite long)

  7. Open the lqs file for your problem queue in your text editor

  8. Overwrite the Security=... line in this file with the contents of your clipboard

  9. Save the modified lqs file

  10. Start the MSMQ service

You should find that the problem queue now has the same permissions as the queue whose security settings you copied at step 6 above.

Jose Basilio
Thanks for this fix - I stumbled across it when I had the same problem.
Damovisa
Just what I needed, but how on earth did you figure that out :-)
Karsten
A: 

Thank you sooooooooooooooo much. How did you know about this. I am searching for this since 1 week.

Raghav
+1  A: 

The solution posted here seems a bit of a hack. Perhaps this is necessary for Windows XP. I've encountered something similar using Windows 7 and used a different approach to solve this.

Situation: Program consists of C# code that creates a private transactional queue Program is run as a windows service, running on the Local System account. When the service is run, the private queue is created with the Local System account as the owner. Even though I am administrator, I can't inspect the messages from the queue.

Solution (this is for Windows 7): run compmgmt.msc open 'Services and Applications' open 'Message Queues' open 'Private Queues' right-click the newly created queue click 'Properties' select the 'Security' tab click 'Advanced' select the 'Owner' tab select 'Administrator' select 'Permissions' tab click 'Add' type in the name of you account (e.g. 'Administrator') click 'Check names' click 'OK' click 'OK' click 'OK'

Now you can access the messages in the queue and also purge the queue if you would like to.

YuriW
A: 

THANK YOU SO MUCH!

Unable to delete MSMQ - this worked perfectly!

Asher
A: 

Thanks a lot, after yours 10 steps privat queue is gone forever. Thanks!

Davor