title: Cannot read remote private queue
body: <p>I'm trying to get MSMQ 5 working on my two Windows Server 2008 R2 virtual machines.
  I can send to local and remote private queues, and I can read from local private queues.
  I can't read from remote private queues.</p>
  
  <p>I've read a number of suggestions, especially the ones summarised by John Breakwell at <a href="https://stackoverflow.com/questions/6983761/msmq-issue-reading-remote-private-queues-again">MSMQ Issue reading remote private queues (again)</a>.</p>
  
  <p>Things I've already done:</p>
  
  <ul>
  <li>Turned off firewalls on both machines.</li>
  <li>Ensured that Everyone and AnonymousLogon have full control of the queues. (If I take away AnonymousLogon access, then I can't remotely send to the queue, and the message ends up with "Access is denied" on the receiving machine.)</li>
  <li>Allowed Nonauthenticated Rpc on both machines. </li>
  <li>Allowed NewRemoteReadServerAllowNoneSecurityClient on both machines.</li>
  </ul>
  
  <p>the sending code fragment is:</p>
  
  <pre><code>        MessageQueue queue = new MessageQueue(queueName, false, false, QueueAccessMode.Send);
          Message msg = new Message("Blah");
          msg.UseDeadLetterQueue = true;
          msg.UseJournalQueue = true;
          queue.Send(msg, MessageQueueTransactionType.Automatic);
          queue.Close();
  </code></pre>
  
  <p>The receiving code fragment is:</p>
  
  <pre><code>   queueName = String.Format("FormatName:DIRECT=OS:{0}\\private$\\{1}",host,id);
     queue = new MessageQueue(queueName, QueueAccessMode.Receive);
     queue.ReceiveCompleted += new ReceiveCompletedEventHandler(receive);
     queue.BeginReceive();
  </code></pre>
  
  <p>...</p>
  
  <pre><code>    public void receive(object sender, ReceiveCompletedEventArgs e)
      {
          queue.EndReceive(e.AsyncResult);
          Console.WriteLine("Message received");
          queue.BeginReceive();
      }
  </code></pre>
  
  <p>My queueName ends up as <code>FormatName:DIRECT=OS:server2\private$\TestQueue</code> </p>
  
  <p>When I call beginReceive() on the queue, I get</p>
  
  <pre><code>Exception: System.Messaging.MessageQueueException (0x80004005)
     at System.Messaging.MessageQueue.MQCacheableInfo.get_ReadHandle()
     at System.Messaging.MessageQueue.ReceiveAsync(TimeSpan timeout, CursorHandle cursorHandle, Int32 action, AsyncCallback callback, Object stateObject)
     at System.Messaging.MessageQueue.BeginReceive()
  </code></pre>
  
  <p>I've used Wireshark on Server1 to look at the network traffic. Without posting all the detail, it seems to go through the following stages. (Server1 is trying to read from a queue on Server2.) </p>
  
  <ul>
  <li>Server1 contacts Server2, and there is an NTLMSSP challenge/response negotiation. A couple of the responses mention "Unknown result (3), reason: Local limit exceeded".</li>
  <li>Server1 sends Server2 an rpc__mgmt_inq_princ_name request, and Server2 replies with a corresponding response.</li>
  <li>There's some ldap exchanges looking up the domain, then a referral to ldap://domain/cn=msmq,CN=Server2,CN=Computers,DC=domain which returns a "no such object" response.</li>
  <li>Then there's some SASL GSS-API encrypted exchange with the LDAP server</li>
  <li>Then connections to the ldap server and Server2 are closed.</li>
  </ul>
  
  <p>I've tried enabling Event Viewer > Applications and Services Logs > Microsoft > Windows > MSMQ > End2End. It shows messages being sent, but no indication of why trying to receive is failing.
  How can I debug this further?</p>