title: Azure - Concurrent call - Service Bus
body: <p>I'm trying to debug an Azure Service Bus.</p>
  
  <p>What i do:</p>
  
  <pre><code>            long countOpen = namespaceManager.GetQueue(queueStrOpen).MessageCount;
              long countClose = namespaceManager.GetQueue(queueStrClose).MessageCount;
              QClientOpen = QueueClient.CreateFromConnectionString(connectionString, queueStrOpen, ReceiveMode.ReceiveAndDelete);
              QClientClose = QueueClient.CreateFromConnectionString(connectionString, queueStrClose, ReceiveMode.ReceiveAndDelete);
  
  
                  if (countOpen &gt; 0)
                  {
                      QClientOpen.OnMessage(OnMessageOpen,eventDrivenMessagingOptions);
                  }
                  if (countClose &gt; 0)
                  {
                      QClientClose.OnMessage(OnMessageClose,eventDrivenMessagingOptions);
                  }
  </code></pre>
  
  <p>What my error is:</p>
  
  <pre><code>Exception: Microsoft.ServiceBus.Messaging.ServerBusyException: Maximum number of
   concurrent receive requests is exceeded on entity '*****:QUEUE:ORDERSPRAC'.
   The limit is '5000'. Error code : 50004.TrackingId:63eefddf-0503-4c30-a2de-55fe
   450ac83c_G4_B21,TimeStamp:5/28/2014 12:57:30 PM.f71029ea-23c6-4ad0-8360-8b27818c
   9046_G4 ---&gt; System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Maximum number of concurrent receive requests is exceeded on entity '*****:QUEUE:ORDERSPRAC'. The limit is '5000'. Error code : 50004.TrackingId:63e efddf-0503-4c30-a2de 55fe450ac83c_G4_B21,TimeStamp:5/28/2014 12:57:30 PM.f71029ea-23c6-4ad0-8360-8b27818c9046_G4
  
   Server stack trace:
   at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequest SessionChannel.ThrowIfFaultMessage(Message wcfMessage)
   at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequest SessionChannel.HandleMessageReceived(IAsyncResult result)
  </code></pre>
  
  <p>This error don't pop everytime. It's just sometimes an Error is catch (the one above).
  How and Why does this message appear whereas I Check IF my messages count are bigger than 0.</p>
  
  <p>It shouldn't make a concurent receive call, but it does and after some day and a lot of IF condition, a lot of google search I'm out of idea.</p>