How long MSMQ queue names are displayed … or not

A few companies pack huge amounts of useful information into their queue names so that it is very easy to work out what each queue is for. A downside of this is that some Windows applications inconsistently display the queue names.

Take the following sample public and private queues I created for test, each 70 characters in length:

 Computer Management displaying long queue names


Performance Monitor can only display 64 characters for the MSMQ queue object which includes the computer name (and "\private$" for private queues) as documented here:

As you can see below, the 70-character private queue becomes 41 characters long after "servername\private$\" is taken into account:

Performance monitor displaying long queue names 

The observant amongst you will notice that this only accounts for 63 characters - there is always an invisible NULL character in the 64th position. 


Now on the other hand, the Server Explorer in Visual Studio can display long private queues but has trouble with public queues:

Visual Studio displaying long queue names

The reason for this is that the queue name is handled differently. Unlike Performance Monitor, there is no fixed 64-byte limit in the application. Instead the limit is in how queue names are stored in Active Directory.  

If we look at the configuration file (found in the system32\msmq\storage\lqs subdirectory) for the private queue:


all the characters are stored in one place.

For public queues, though, only the first 64 characters will fit in the field used to store the name in Active Directory and the remainder of the name gets stored in another field (mSMQQueueNameExt).

Depending on the operation, MSMQ performs :

  • two Active Directory lookups to get the full name (as seen in Computer Management), or

  • one Active Directory lookup to get the distinguished name where a “hash” suffix is used for long names instead (as seen in VS Server Explorer)

There is a more important "Gotcha" although you are VERY unlikely to see it. It goes like this:

  1. Create a public queue called "1111111111222222222233333333334444444444555555555566666666667777777777". As in the screenshot above, this will have a distinguised name of "1111111111222222222233333333334444444444555555555566666-0A479588".

  2. Create a public queue called "1111111111222222222233333333334444444444555555555566666-0A479588".

  3. Send a message to the first public queue name - the message will arrive in the specified queue.

  4. Send a message to the second public queue name - the message will arrive in the first public queue.

Personally I can't see any real-world scenarios where somebody would get this problem but I thought I would add it for completeness.


Best practice - stick to 63 characters for public or private queues and you won't go wrong.

Comments (0)

Skip to main content