Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

accessing public message queues

Posted on 2006-11-08
7
Medium Priority
?
737 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
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…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

647 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