PC Review


Reply
Thread Tools Rate Thread

MessageQueueException in ReadHandle

 
 
=?Utf-8?B?QW5kcmV3IEhheWVz?=
Guest
Posts: n/a
 
      26th Feb 2004
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?
 
Reply With Quote
 
 
 
 
Yoel Arnon [MSFT]
Guest
Posts: n/a
 
      26th Feb 2004
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.

"Andrew Hayes" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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)
> {
> 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

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 59
>
> 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 0
> 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 -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?


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
EndPeek throwing MessageQueueException with MessageQueueErrorCode set to -1073741536 Craig Microsoft C# .NET 0 14th Sep 2005 02:50 PM
EndPeek throwing MessageQueueException Craig Microsoft C# .NET 2 14th Sep 2005 08:44 AM
Re: MessageQueueException in ReadHandle =?Utf-8?B?QW5kcmV3IEhheWVz?= Microsoft Windows 2000 Active Directory 14 22nd Mar 2004 09:44 AM
An unhandled exception of type 'System.Messaging.MessageQueueException' occurred Tony Hamill Microsoft C# .NET 2 29th Oct 2003 10:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:30 PM.