Search code examples
.netsecuritymsmq

MSMQ Access Denied


I am attempting to access a queue and receiving an access denied error. The confusing part is the queue is setup to allow everyone at full control as well as anonymous and machinename$ (all three are full control - it's a test system so not a big deal). I am able to successfully write to the queue but can't Peek/Read/Receive from it. I found one article on here that suggested using the FormatName method but unfortunately I am already doing this.

The catch to this is my system is on one AD domain and the test server is running against another domain entirely (my client's). Am I trying to accomplish the impossible with this?

My platform is Vista x64 and the server is 2008 (not R2).

The code looks like this:

    Do While Not m_boolCancel

        '**Code dies on this line**
        l_ar = m_mq.BeginPeek

        'block thread till message arrived or shutdown is signalled
        If WaitHandle.WaitAny(New WaitHandle() {m_sig, l_ar.AsyncWaitHandle}) > 0 Then

            l_msg = m_mq.EndPeek(l_ar)

            If l_msg IsNot Nothing Then

                'doing stuff here

            End If

            Exit Do
        End If

Solution

  • For MSMQ to work across domains the domains in question have to have a two way trust established. The message queue has to be a public queue. If you have it set as a transactional queue, both client and server must be using MSMQ 4.0 (part of windows server 2008 and later)