HttpHandler and Messaging

J

JoostV

Hi,

I have a very simple sample application to put a message on a (public)
queue. This sample works fine in a standalone application.

However, it doesn't work anymore if I put the content of the
Main-program in the ProcessRequest of an HttpHandler. Does anybody
have a clue why this happens?? Am I doing something wrong??

The error I get in this case is "Queue with the specified path name is
already registered in the DS." or "Queue is not registered in the DS."
depending if the queue exist if I start running the program.

namespace PutOnQueueTest
{
class Class1
{
private string m_queueName = string.Empty;
private MessageQueue m_messageQueue;

public Class1()
{
m_queueName = @"myqueue";
if ( !MessageQueue.Exists( FullQueueName(m_queueName) ) )
MessageQueue.Create( FullQueueName(m_queueName) );

m_messageQueue = new MessageQueue( FullQueueName(m_queueName) );
}

private string FullQueueName( string queueName )
{
string fullQueName = @".\" + queueName;
return fullQueName;
}

public void ProcessRequest()
{
String hello = "hello";
m_messageQueue.Send( hello );
}

[STAThread]
static void Main(string[] args)
{
Class1 test = new Class1();
test.ProcessRequest();
}
}
}
 
A

Alvin Bruney [MVP]

so in a web page it behaves funky and in a desktop it does not?

have you checked permissions? you need to give permissions to the local
account the asp.net engine uses in order to touch the queue - since the
queue is a glorified file anyway.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top