Discussion:
MessageQueueException in ReadHandle
(too old to reply)
Andrew Hayes
2004-02-26 07:11:06 UTC
Permalink
Hi All

I've got some code that enumerates the public message queues on various remote servers and I've run into a snag..

First, here's a code snippet that is mostly working

MessageQueue[] qList = MessageQueue.GetPublicQueuesByMachine( mName )

foreach(MessageQueue queueItem in qList

tr

queueItem.Formatter = new BinaryMessageFormatter()

queueItem.MessageReadPropertyFilter.SetAll()

MessageEnumerator myEnumerator = queueItem.GetMessageEnumerator()

while(myEnumerator.MoveNext()

tr

mMessageCount++

catch (Exception exp

MessageBox.Show( exp.Message, "Error Getting Message" )



catch (Exception exp

MessageBox.Show( exp.Message, "Error Getting Queue" )


MessageBox.Show( queueItem.Path + ":" + mMessageCount, "Message Count for Queue" )


OK. For most of the servers this works great... Except for 1. It's a newly installed Windows 2003 Server and the myEnumerator.MoveNext() call throws a MessageQueueException with no message text..

Well, I say that but the _message element says "External component has thrown an exception." and _stackTraceString shows

at System.Messaging.MQCacheableInfo.get_ReadHandle(
at System.Messaging.MessageEnumerator.get_CursorHandle(
at System.Messaging.MessageEnumerator.MoveNext(TimeSpan timeout
at System.Messaging.MessageEnumerator.MoveNext(
at QueueMonitor.EnumerateQueues() in c:\projects\queuemonitor\queuemonitor.cs:line 5

So, I put in a breakpoint on the queueItem.Formatter line and hit Shift+F9 to QuickWatch queueItem... That's when I noticed

ReadHandle <error: an exception of type: {System.Messaging.MessageQueueException} occurred

I step through to after the myEnumerator construction and take a look at that

Handle
Current <error: an exception of type: {System.InvalidOperationException} occurred
CursorHandle <error: an exception of type: {System.Messaging.MessageQueueException} occurred

Seems I can't get the Handle for the Message Queue, which in turn means I can't get a Handle for the Enumerator... So I checked the security on the remote public queue I was enumerating and ( like everyone else on these NG's seems to do ) it was set to Everyone - Full Control... My machine and the remote machine both belong to the same Active Directory domain, and DNS is correctly setup for that to work... I believe..

Looking at the Exception instance I also see

_COMPlusExceptionCode -53245969
_HResult -214746725
MessageQueueErrorCode -214702307

Searching for 0x80070721 (-2147023071) seems to indicate it's a DCOM Automation error to do with security packages, so maybe there is something extra I need to do in 2K3 to allow me to enumerate the messages in the public queues..

Anyone have any thoughts, comments, ideas, suggestions or, preferably, solutions?
Yoel Arnon [MSFT]
2004-02-26 20:07:04 UTC
Permalink
Hi Andrew,
There seems to be some kind of authentication problem between your
Windows2003 server and the domain controller. The problem occurs in the
Active Directory access layer "under" MSMQ.

I would check the following:
1. Can you see the queues when running Active Directory Users and Computers
from the Windows 2003 box?
2. Does your program run as a service / ASP / COM+ component / Cluster
resource orany other special security context?
3. When you installed MSMQ, did it ask you for a DS server? (If it did, it
cannot locate the Active Directory through DNS, and it uses the old MSMQ 1.0
/ 2.0 interface)
4. Is your DNS configured right? (simple test: ping your DC using its short
netbioos name, and see if ping says "pinging <netbios name>" or "pinging
<full DNS name>. The former usually means that DNS is not configured right.

HTH,
Yoel
---
This posting is provided "AS IS" with no warranties, and confers no rights.
Hi All,
I've got some code that enumerates the public message queues on various
remote servers and I've run into a snag...
MessageQueue[] qList = MessageQueue.GetPublicQueuesByMachine( mName );
foreach(MessageQueue queueItem in qList)
{
try
{
queueItem.Formatter = new BinaryMessageFormatter();
queueItem.MessageReadPropertyFilter.SetAll();
MessageEnumerator myEnumerator = queueItem.GetMessageEnumerator();
while(myEnumerator.MoveNext())
{
try
{
mMessageCount++;
}
catch (Exception exp)
{
MessageBox.Show( exp.Message, "Error Getting Message" );
}
}
}
catch (Exception exp)
{
MessageBox.Show( exp.Message, "Error Getting Queue" );
}
MessageBox.Show( queueItem.Path + ":" + mMessageCount, "Message Count
for Queue" );
}
OK. For most of the servers this works great... Except for 1. It's a newly
installed Windows 2003 Server and the myEnumerator.MoveNext() call throws a
MessageQueueException with no message text...
Well, I say that but the _message element says "External component has
at System.Messaging.MQCacheableInfo.get_ReadHandle()
at System.Messaging.MessageEnumerator.get_CursorHandle()
at System.Messaging.MessageEnumerator.MoveNext(TimeSpan timeout)
at System.Messaging.MessageEnumerator.MoveNext()
at QueueMonitor.EnumerateQueues() in
c:\projects\queuemonitor\queuemonitor.cs:line 59
So, I put in a breakpoint on the queueItem.Formatter line and hit Shift+F9
{System.Messaging.MessageQueueException} occurred>
I step through to after the myEnumerator construction and take a look at
Handle 0
{System.InvalidOperationException} occurred>
{System.Messaging.MessageQueueException} occurred>
Seems I can't get the Handle for the Message Queue, which in turn means I
can't get a Handle for the Enumerator... So I checked the security on the
remote public queue I was enumerating and ( like everyone else on these NG's
seems to do ) it was set to Everyone - Full Control... My machine and the
remote machine both belong to the same Active Directory domain, and DNS is
correctly setup for that to work... I believe...
_COMPlusExceptionCode -532459699
_HResult -2147467259
MessageQueueErrorCode -2147023071
Searching for 0x80070721 (-2147023071) seems to indicate it's a DCOM
Automation error to do with security packages, so maybe there is something
extra I need to do in 2K3 to allow me to enumerate the messages in the
public queues...
Anyone have any thoughts, comments, ideas, suggestions or, preferably, solutions?
Andrew Hayes
2004-02-27 06:01:06 UTC
Permalink
Hi Yoel

Thanks for the reply. In order to convey more information I am going to focus on 3 machines..

2003SA - The Windows 2003 Server Standard Edition that I am developing on
2003SB - The newly installed Windows 2003 Server Standard Edition member server
2000DC - The Windows 2000 Server Active Directory Domain Controller (and DNS Server of course

All 3 machines are members of the domain controlled by 2000DC, which we'll call DOMAIN

My answers to your questions are as follows

1. Can you see the queues when running Active Directory Users and Computers from the Windows 2003 box

2003SA and 2003SB do not show Active Directory Users and Computers under Adminstrative Tools. I have to go through the MMC and add the Snap-in... In the end I don't see any queues there, only MSMQ Users

When I use Computer Management from 2003SA/2000DC and connect to 2003SB I do not see Message Queuing under the Services and Applications tree, but if I use Computer Management from 2003SB and connect to 2003SA/2000DC I can see Message Queuing and the underlying queues

This would imply that 2003SB is hiding MSMQ settings even from the admin account via 2000DC... I do not know where this is changed

2. Does your program run as a service / ASP / COM+ component / Cluster resource or any other special security context

No. It's a standard Visual C# .NET Windows Application

3. When you installed MSMQ, did it ask you for a DS server? (If it did, it cannot locate the Active Directory through DNS, and it uses the old MSMQ 1.0 / 2.0 interface

2003SB did not ask for a DS server, and I don't recall whether 2003SA did. I believe that in both cases the machines were members DOMAIN and the 2000DC admin account had been used to logon

4. Is your DNS configured right? (simple test: ping your DC using its short netbioos name, and see if ping says "pinging <netbios name>" or "pinging <full DNS name>. The former usually means that DNS is not configured right

Pinging 2000DC from 2003SB shows the fully qualified 2000DC.DOMAIN name

If you have any further thoughts, or ways that I can extract more detailed information, please feel free to post.
Frank Boyne
2004-03-01 05:59:40 UTC
Permalink
Post by Andrew Hayes
2003SA and 2003SB do not show Active Directory Users and
Computers under Adminstrative Tools. I have to go through the
MMC and add the Snap-in... In the end I don't see any queues
there, only MSMQ Users.
If I recall correctly, Active Directory tools are only automatically
installed on Domain Controllers. Find adminpak.msi on your Windows
Server 2003 CD and install that to get the admin tools installed on
non domain controllers.

Your having to add the snap-in sounds wrong.
Post by Andrew Hayes
When I use Computer Management from 2003SA/2000DC
and connect to 2003SB I do not see Message Queuing under
the Services and Applications tree, but if I use Computer
Management
Post by Andrew Hayes
from 2003SB and connect to 2003SA/2000DC I can see
Message Queuing and the underlying queues.
It might be worth comparing the MSMQ installs on those two systems.
Run Add/Remove Programs and select Add/Remove Windows Components and
then select Application Server and click on details - are the MSMQ
components installed on 2003SA and 2003SB the same?
Post by Andrew Hayes
This would imply that 2003SB is hiding MSMQ settings
even from the admin account via 2000DC.
Or else it is having problems communicating with 2000DC, or
accessing data in AD on 2000DC and so can't display the settings?
Andrew Hayes
2004-03-03 09:06:15 UTC
Permalink
Thanks for the adminpak.msi tip Frank. Did that and now I have *all* the Administrative Tools...

OK. For the MSMQ setup, both 2003 machines show Active Directory Integration and Common as installed.

If 2003SB was having problems with Active Directory or 2000DC then surely the MSMQ tree for 2000DC would be unavailable when using Computer Management on 2003SB? I can see the 2000DC Message Queuing tree from 2003SB, but I can't see the 2003SB Message Queuing tree from 2000DC.

The AD Domain Admins group is a member of the 2000SB Administrators group, and in all cases I logon to the machines using an AD Domain Admin account.

Anything else I should look at?
Doron Juster [MSFT]
2004-03-03 13:21:52 UTC
Permalink
Can you see the 2003SB tree when running locally, on that computer ?
Any error events from msmq in the applications events log (on 2003SB) ?
Reading through this thread and your other posts I start thinking that the
msmq service is not running on 2003SB. In that case, you can still use
computer management to view the msmq tree on other computers (which do run
msmq). But you won't be able to expand a remote queue and see its messages.
And you won't be able to see the local msmq tree.

Thanks, Doron
--
This posting is provided "AS IS" with no warranties, and confers no rights.
.
Post by Andrew Hayes
Thanks for the adminpak.msi tip Frank. Did that and now I have *all* the
Administrative Tools...
Post by Andrew Hayes
OK. For the MSMQ setup, both 2003 machines show Active Directory
Integration and Common as installed.
Post by Andrew Hayes
If 2003SB was having problems with Active Directory or 2000DC then surely
the MSMQ tree for 2000DC would be unavailable when using Computer Management
on 2003SB? I can see the 2000DC Message Queuing tree from 2003SB, but I
can't see the 2003SB Message Queuing tree from 2000DC.
Post by Andrew Hayes
The AD Domain Admins group is a member of the 2000SB Administrators group,
and in all cases I logon to the machines using an AD Domain Admin account.
Post by Andrew Hayes
Anything else I should look at?
Andrew Hayes
2004-03-04 01:36:05 UTC
Permalink
Hi Doron

Thanks for the assistance so far. Here's some more info

In Computer Management, connected locally on 2003SB, I can see the Message Queuing tree and I can create, delete, and purge public and private queues. I can also see the messages that were sent from 2003SA via the Diagnostics "Send test messages" feature, as I was able to create a public queue on 2003SB using the "New Queue..." button on the Send test messages dialog from 2003SA

I can programmatically enumerate the public and private queues on 2003SB from 2003SA but I cannot enumerate the messages in the queues because of the exception thrown by System.Messaging, as detailed in my first post in this thread, so I would say that MSMQ is running on 2003SB, but with some security or other issues that I have not yet been able to identify

What I will do is code another test program to use the various programmatic methods for remotely enumerating and creating queues; sending, peeking and reading messages; etc., and see which ones fail, and how they fail

Regards...Andre
Doron Juster [MSFT]
2004-03-04 08:14:15 UTC
Permalink
Ok, thanks. Now I understand your scenario much better.

Essentially, you're concerned with:

I can programmatically enumerate the public and private queues on 2003SB
from 2003SA but I cannot enumerate the messages in the queues because of the
exception thrown by System.Messaging

And you refer to error 0x80070721 (from your first post). In other posts you
mentioned that you're logon as a NT4 user (from a NT4 domain which has
bi-directional trust with the Active Directory forest).

I have one more question, trying to fully understand the scenario.
How are you logged on 2003SA when you fail to read from 2003SB ? as a NT4
user or as a Active Directory domain user ?
I ask this because 0x80070721 may indicates a problem with rpc
authentication. RPC is used by msmq for remote read. If you're logged on as
NT4 user, then msmq fall back to NTLM authentication. If you're logged as a
Active Directory domain user then msmq may use rpc with encryption and
Kerberos.
Can you try same operation that fail while logged on once as NT4 user and
then as Active Directory user ?

Thanks, Doron
--
This posting is provided "AS IS" with no warranties, and confers no rights.
.
Hi Doron,
In Computer Management, connected locally on 2003SB, I can see the Message
Queuing tree and I can create, delete, and purge public and private queues.
I can also see the messages that were sent from 2003SA via the Diagnostics
"Send test messages" feature, as I was able to create a public queue on
2003SB using the "New Queue..." button on the Send test messages dialog from
2003SA.
I can programmatically enumerate the public and private queues on 2003SB
from 2003SA but I cannot enumerate the messages in the queues because of the
exception thrown by System.Messaging, as detailed in my first post in this
thread, so I would say that MSMQ is running on 2003SB, but with some
security or other issues that I have not yet been able to identify.
What I will do is code another test program to use the various
programmatic methods for remotely enumerating and creating queues; sending,
peeking and reading messages; etc., and see which ones fail, and how they
fail.
Regards...Andrew
Frank Boyne
2004-03-04 05:51:45 UTC
Permalink
Post by Andrew Hayes
Anything else I should look at?
The only other thing I can think of is turning on some of the
diagnostics described in the MSMQ FAQ troubleshooting section. The
FAQ can be found here:
http://www.microsoft.com/windows2000/technologies/communications/msmq/wp_msmqfaq.asp

These diagnostics are really for Microsoft to use, but sometimes us
mere civilians can also get some idea of what is going wrong :-)
Doron Juster [MSFT]
2004-03-01 14:23:01 UTC
Permalink
What do you mean by
"In the end I don't see any queues there, only MSMQ Users." ?
Do you see a container called "MSMQ Users" ?

Thanks, Doron
--
This posting is provided "AS IS" with no warranties, and confers no rights.
.
Hi Yoel,
Thanks for the reply. In order to convey more information I am going to
focus on 3 machines...
2003SA - The Windows 2003 Server Standard Edition that I am developing on.
2003SB - The newly installed Windows 2003 Server Standard Edition member
server.
2000DC - The Windows 2000 Server Active Directory Domain Controller (and
DNS Server of course)
All 3 machines are members of the domain controlled by 2000DC, which we'll
call DOMAIN.
1. Can you see the queues when running Active Directory Users and
Computers from the Windows 2003 box?
2003SA and 2003SB do not show Active Directory Users and Computers under
Adminstrative Tools. I have to go through the MMC and add the Snap-in... In
the end I don't see any queues there, only MSMQ Users.
When I use Computer Management from 2003SA/2000DC and connect to 2003SB I
do not see Message Queuing under the Services and Applications tree, but if
I use Computer Management from 2003SB and connect to 2003SA/2000DC I can see
Message Queuing and the underlying queues.
This would imply that 2003SB is hiding MSMQ settings even from the admin
account via 2000DC... I do not know where this is changed.
2. Does your program run as a service / ASP / COM+ component /
Cluster resource or any other special security context?
No. It's a standard Visual C# .NET Windows Application.
3. When you installed MSMQ, did it ask you for a DS server? (If it
did, it cannot locate the Active Directory through DNS, and it uses the old
MSMQ 1.0 / 2.0 interface)
2003SB did not ask for a DS server, and I don't recall whether 2003SA did.
I believe that in both cases the machines were members DOMAIN and the 2000DC
admin account had been used to logon.
4. Is your DNS configured right? (simple test: ping your DC using its
short netbioos name, and see if ping says "pinging <netbios name>" or
"pinging <full DNS name>. The former usually means that DNS is not
configured right.
Pinging 2000DC from 2003SB shows the fully qualified 2000DC.DOMAIN name.
If you have any further thoughts, or ways that I can extract more detailed
information, please feel free to post.
Loading...