MSMQ woes

  • Thread starter Thread starter Brad Quinn
  • Start date Start date
B

Brad Quinn

Why, when I call MessageQueue.GetPublicQueuesByMachine from
a WebApplication, do I get the following exception?

When I excecute the same code in a "WindowsApplication" I
get the expected result.

1) Exception Information
*********************************************
Exception Type: System.Messaging.MessageQueueException
MessageQueueErrorCode: -1072824176
Message: NULL
ErrorCode: -2147467259
TargetSite: System.Guid GetMachineId(System.String)
HelpLink: NULL
Source: System.Messaging

StackTrace Information
*********************************************
at System.Messaging.MessageQueue.GetMachineId(String
machineName)
at
System.Messaging.MessageQueueCriteria.set_MachineName(String
value)
at
System.Messaging.MessageQueue.GetPublicQueuesByMachine(String
machineName)
at WebQueueManager.WebForm1.btnLookup_Click(Object
sender, EventArgs e) in
c:\inetpub\wwwroot\webqueuemanager\webform1.aspx.cs:line 65

The simplest code that misbehaves in my WebApplication is
MessageQueue.Exists( queuePath ), but that doen't provide
any additional information.

I'm pretty sure I've solved this problem before with
version 1.0 of the framework, when I recall changing
permissions on the queue. This doesn't seem to be the same
problem though.

Thanks,
Brad
 
I've found an acceptable way around my problem.

I'm using the this path
"FormatName:DIRECT=OS:.\\LogManager" instead of
".\\LogManager".

It seems that my WebApplication doesn't have permission to
"see" message queues via Active Directory (or whatever
mechanism is used).

It seems that MessageQueue.Exists doesn't work with this
path format. So I either need to send a test message to
the queue or peek at it to know if it exists. I don't
particularly want to give my web application peek
permission, so I guess I'll modify my queue consumer to
ignore the test message.
 
Back
Top