Solved

accessing public message queues

Posted on 2006-11-08
7
724 Views
Last Modified: 2007-12-19
Hello,
I am using message queues in C# asp.net 1.1.  I create a public message queue and on subsequent execution of the code, I check if the queue exists. If it does, I don't want to create it again. The queue gets created successfully, but the problem is MessageQueue.Exists method or GetPublicQueuesByMachine method can't find this queue once it is created, so the control goes to the 'create' statement again and it fails by giving this error:

System.Messaging.MessageQueueException: Queue with the specified path name is already registered in the DS.

The GetPublicQueuesByMachine method does't find this queue and gives the Unhandled Execution Error and MessageQueueException with message text as NULL.

But GetPrivateQueuesByMachine method works fine and retrieves all private queues. Another thing is, if the same code is run in a Windows Application, it works fine and retrieves the public queue.
So why does it not find the PUBLIC queue in a WEB application?  here is my code. Please help.

if (!MessageQueue.Exists(".\\requestq"))                        //???
{
   MessageQueue requestq = MessageQueue.Create(".\\requestq");
}

MessageQueue[] mqlist = null;
try
{
   mqlist = MessageQueue.GetPublicQueuesByMachine(".");         //???
}
catch (MessageQueueException ex)
{
   string mesg = ex.Message;
}
0
Comment
Question by:engg
  • 4
  • 2
7 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17905564
According to this article

   http://msdn2.microsoft.com/en-us/library/system.messaging.messagequeue.exists.aspx

you seem to have everything correct, but with ASP.NET it may be a problem with authentication.  If you allow anonymous access to the web site, a special user with limited access is used to access external resources, such as message queues.

Bob
0
 

Author Comment

by:engg
ID: 17907110
Thanks Bob. How could that be done?
(I am using forms authentication if it has any relevance.)
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 17937431
One idea would be to use impersonation:

ASP.NET Impersonation
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsent7/html/vxconImpersonation.asp

Bob
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:engg
ID: 17938341
Thanks Bob. I will look into it and will get back.
0
 

Author Comment

by:engg
ID: 18057289
Private queues are serving the purpose for the time being.
I will look into public queues soon.
0
 

Author Comment

by:engg
ID: 18199014
sorry about the delay.
Thanks.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now