Solved

accessing public message queues

Posted on 2006-11-08
7
729 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
convert html to string 6 34
ASP.NET MVC identity 6 26
List<PaisEntity> - show some 1 24
Save ms data to server side. 19 42
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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

808 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