469,623 Members | 1,371 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,623 developers. It's quick & easy.

An unhandled exception of type 'System.Messaging.MessageQueueException' occurred

Hi,
I am trying to set up a VERY simple project to send message to MSMQ from
..Net using C#. When I run my code it throws an exception

"An unhandled exception of type 'System.Messaging.MessageQueueException'
occurred in system.messaging.dll"

I can only find one other link from Google (
http://www.dotnet247.com/247referen...s/14/73719.aspx )where this has
occured. Can someone help me out here. I find it hard to believe that apart
from myself only one other person has seen this issue.
Source Code:
public void SendMessageTransactional()
{
if (MessageQueue.Exists(@".\Private$\TestQueue"))
{
// Connect to a queue on the local computer.
MessageQueue myQueue = new MessageQueue(@".\Private$\TestQueue");

// Send a message to the queue.
if (myQueue.Transactional == true)
{
myQueue.Send("My Message Data.", "a Label");
return;
}
}
}

I can send messages to the queue from VB6, so the queue itself is fine. The
queue is private, absolutely nothing odd about it. I have created several
queues all the same result from dotnet.

Any help is greatly appreciated, this is very annoying
Nov 15 '05 #1
2 6936
Hi,

I have found that your code checks for message queue transactional mode
(myQueue.Transactional == true) but uses Send method without starting new
transaction. Try the following:

if (myQueue.Transactional == true)
{
using (MessageQueueTransaction trans = new MessageQueueTransaction())
{
trans.Begin();
myQueue.Send("My Message Data.", "a Label", trans);
trans.Commit();
}
return;
}

--
Andrew Gnenny
pulsar2003@/no-spam/email.ru (Please remove /no-spam/ for reply)
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
"Tony Hamill" <an************@ntlworld.com1> wrote in message
news:O7**************@TK2MSFTNGP11.phx.gbl...
Hi,
I am trying to set up a VERY simple project to send message to MSMQ from
.Net using C#. When I run my code it throws an exception

"An unhandled exception of type 'System.Messaging.MessageQueueException'
occurred in system.messaging.dll"

I can only find one other link from Google (
http://www.dotnet247.com/247referen...s/14/73719.aspx )where this has
occured. Can someone help me out here. I find it hard to believe that apart from myself only one other person has seen this issue.
Source Code:
public void SendMessageTransactional()
{
if (MessageQueue.Exists(@".\Private$\TestQueue"))
{
// Connect to a queue on the local computer.
MessageQueue myQueue = new MessageQueue(@".\Private$\TestQueue");

// Send a message to the queue.
if (myQueue.Transactional == true)
{
myQueue.Send("My Message Data.", "a Label");
return;
}
}
}

I can send messages to the queue from VB6, so the queue itself is fine. The queue is private, absolutely nothing odd about it. I have created several
queues all the same result from dotnet.

Any help is greatly appreciated, this is very annoying

Nov 15 '05 #2
Andrew,
many thanks for this, that was the issue.

Tony.
"Andrew Gnenny" <pulsar2003@/no-spam/email.ru> wrote in message
news:3f********@nexus.validio.com.ua...
Hi,

I have found that your code checks for message queue transactional mode
(myQueue.Transactional == true) but uses Send method without starting new
transaction. Try the following:

if (myQueue.Transactional == true)
{
using (MessageQueueTransaction trans = new MessageQueueTransaction())
{
trans.Begin();
myQueue.Send("My Message Data.", "a Label", trans);
trans.Commit();
}
return;
}

--
Andrew Gnenny
pulsar2003@/no-spam/email.ru (Please remove /no-spam/ for reply)
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
"Tony Hamill" <an************@ntlworld.com1> wrote in message
news:O7**************@TK2MSFTNGP11.phx.gbl...
Hi,
I am trying to set up a VERY simple project to send message to MSMQ from
.Net using C#. When I run my code it throws an exception

"An unhandled exception of type 'System.Messaging.MessageQueueException'
occurred in system.messaging.dll"

I can only find one other link from Google (
http://www.dotnet247.com/247referen...s/14/73719.aspx )where this has
occured. Can someone help me out here. I find it hard to believe that

apart
from myself only one other person has seen this issue.
Source Code:
public void SendMessageTransactional()
{
if (MessageQueue.Exists(@".\Private$\TestQueue"))
{
// Connect to a queue on the local computer.
MessageQueue myQueue = new MessageQueue(@".\Private$\TestQueue");

// Send a message to the queue.
if (myQueue.Transactional == true)
{
myQueue.Send("My Message Data.", "a Label");
return;
}
}
}

I can send messages to the queue from VB6, so the queue itself is fine.

The
queue is private, absolutely nothing odd about it. I have created several queues all the same result from dotnet.

Any help is greatly appreciated, this is very annoying


Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Professor Frink | last post: by
5 posts views Thread by Paw Pedersen | last post: by
2 posts views Thread by Ed Crowley | last post: by
1 post views Thread by =?Utf-8?B?Wmlub24=?= | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.