I am trying to get a count of MSMQ messages from a private queue on a local Win7 Enterpri开发者_开发问答se machine. I can get the count from a remote machine without problem and the code works on Win2008 Server R2. I am using C# VS 2008.
Code sample:
int result = MQMgmtGetInfo(cname, "queue=DIRECT=OS:" + qname, ref props);
where cname
is the machine name with private queue, MyLocalComputer
, and
qname
is the path reference to the private queue, MyLocalComputer\\private$\\QueueName
When I call this code from the Win7 computer containing the private queue I get a -1072824319
return value. There are messages in the queue.
If I call this code from a WinXP computer to get counts on the Win7 queue, I get correct counts. I can also call the code from a WinXP computer to get counts from a local private queue on the same WinXP machine and get correct counts.
Is there something different about accessing local private queues on Win7? Since I can access the queue remotely I wouldn't think it is a permissions issue, but I may be wrong.
Sounds like you are using the MSMQ 3.0 API. Windows 7 uses MSMQ 4.0.
In the .NET references window look for System.Messaging (version 4.0.0.0) and add to your project.
Take a look in this link: http://www.codeproject.com/KB/cs/mgpmyqueue.aspx
[]'s
Renan
-1072824319 = 0xC00E0001 which is a generic MSMQ error.
Try using a full stop instead of the machine name.
That will tell MSMQ to use "local host".
If that works then there may be a problem with the machine resolving it's own name.
Cheers
John Breakwell
精彩评论