I have just developed an application hosted on Windows 2003 Server that employs MSMQ 3.0 technology to manage transactions from a web service.
I created a function to create a private queue and used the samples in MSDN.
When I tried to view the queue from within MMC, I found that I did not have access, even though I was an Administrator. I got messages to do with opening a “Security Descriptor”. Googling for this problem revealed similar problems but no solution.
So I checked out the MessageQueue Class in MSDN and found the culprit. I needed to grant explicit access rights at creation. Thus the code is as follows:
Private Sub Init()
Dim QueueFromWeb As String = “.\private$\OnlineSalesInbound”
Dim QueueToWeb As String = “.\private$\OnlineSalesOutbound”
Dim QueueInbound As MessageQueue = New MessageQueue(QueueFromWeb)
Dim QueueOutbound As MessageQueue = New MessageQueue(QueueToWeb)
If Not MessageQueue.Exists(QueueFromWeb) Then
QueueInbound.Label = QueueFromWeb
QueueInbound.Authenticate = False
QueueInbound.SetPermissions(“MyDomain\Domain Admins”, MessageQueueAccessRights.FullControl)
QueueInbound.MessageReadPropertyFilter.CorrelationId = True
QueueInbound.UseJournalQueue = True
If Not MessageQueue.Exists(QueueToWeb) Then
QueueOutbound.Label = QueueToWeb
QueueOutbound.Authenticate = False
QueueOutbound.SetPermissions(“MyDomain\Domain Admins”, MessageQueueAccessRights.FullControl)
QueueOutbound.UseJournalQueue = True
The addition of the bolded code fixed the problem.
Technorati tags: MSMQ