473,414 Members | 1,948 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

MessageQueueException in ReadHandle

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_CursorHandl e(
at System.Messaging.MessageEnumerator.MoveNext(TimeSp an 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?
Nov 15 '05 #1
1 7985
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" <an*******@discussions.microsoft.com> wrote in message
news:6E**********************************@microsof t.com...
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_CursorHandl e()
at System.Messaging.MessageEnumerator.MoveNext(TimeSp an 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?
Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tony Hamill | last post by:
Hi, I am trying to set up a VERY simple project to send message to MSMQ from ..Net using C#. When I run my code it throws an exception "An unhandled exception of type...
5
by: Paw Pedersen | last post by:
When I catch an exception I can see the NativeErrorCode when I'm debugging through the code, but how do I get this programatically? I need to check if the exception I catch is with nativeErrorCode...
2
by: Craig | last post by:
Hi, Would appreciate any help you guys have to offer. On calling beginPeek on instantiation of a MessageQueue, EndPeek throws a MessageQueueException. If the queue exists already, the exception is...
0
by: Craig | last post by:
Hi, Would appreciate any help you guys have to offer. On calling beginPeek on instantiation of a MessageQueue, EndPeek throws a MessageQueueException. If the queue exists already, the exception is...
0
by: rs | last post by:
Hi guys, I am trying to read from a USB keyboard using vb.net and HID classes. the USB keyboard is not my primary keyboard. I have a ps2 keyboard connected and is detected in device manager as...
2
by: rs | last post by:
Hi guys, I am trying to read from a USB keyboard using vb.net and HID classes. the USB keyboard is not my primary keyboard. I have a ps2 keyboard connected and is detected in device manager as...
2
by: Eugene Anthony | last post by:
I am having a problem with my try and catch found in the code bellow. It never works when there is no msg in the queue. The code bellow is to read and process one message at a time. Upon completing...
0
by: saurabh143 | last post by:
Hello All I am trying to read HID numpad using VB programme of Mr. Jan Axelson named as " usbhidio.vb ", available on HID page of www.lvr.com. But its not giving me succesful output....
0
by: davidsimmonds | last post by:
Here is some code. The m_queue.BeginReceive method gets called, but after a few seconds it throws an exception which is caught, but the ex variable is null. My MessageArrived method is never called...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.