Groups | Blog | Home
all groups > dotnet datatools > february 2006 >

dotnet datatools : cannot post to MSMQ from dotnet code


Jack
2/4/2006 11:58:39 PM

I am not able to post a simple message locally to my local MSMQ through this
code although I can post to the same queue using some demo code.

My code is


using System;
using System.Collections.Generic;
using System.Xml;
using System.IO;
using System.Text;
using System.Reflection;
using System.Messaging;

namespace WindowsApplication1
{
static class test
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{


string oobject;
Message mymessage = new Message();
MessageQueue myMSMQueue = new MessageQueue();
MessageQueueTransaction myquetrans = new
MessageQueueTransaction();
ActiveXMessageFormatter xmlmessageformat = new
ActiveXMessageFormatter();
myMSMQueue.Path = (@".\private$\incoming");


oobject = "message sent";
mymessage.Label = "testx";
mymessage.Body = oobject;
try
{
myMSMQueue.Send(oobject);
}
catch (MessageQueueException ex)
{
Console.WriteLine("message " + ex.Message);
Console.WriteLine("message " + ex.Source);
Console.WriteLine("message " + ex.InnerException.Message);
}

myMSMQueue.Close();

}
}
Jack
2/5/2006 9:52:27 AM
No, it is created by an application that I installed.

I created a manual queue and the code works with the manual queue but does
not work with this one. What do I look at in the queue to resolve this one?

[quoted text, click to view]
Michael Nemtsev
2/5/2006 3:33:51 PM
Hello Jack,

Did you manually create this private group with name "incoming" in Message
Queuing Admin?

J> I am not able to post a simple message locally to my local MSMQ
J> through this code although I can post to the same queue using some
J> demo code.
J>
J> My code is
J> myMSMQueue.Path = (@".\private$\incoming");

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

Jack
2/6/2006 1:27:11 PM
I fixed the issue. Thank you for your help.

I am trying to receive this xml file from my customer. How do I set up the
receiver to receive this file over the web? Any code example will be
appreciated.

[quoted text, click to view]
Michael Nemtsev
2/6/2006 6:02:42 PM
Hello Jack,

I mean, did that created queue exist in MSMQ Admin MMC Console? Can you open
it?

J> No, it is created by an application that I installed.
J>
J> I created a manual queue and the code works with the manual queue but
J> does not work with this one. What do I look at in the queue to
J> resolve this one?
J>
[quoted text, click to view]
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

Michael Nemtsev
2/6/2006 7:21:17 PM
Hello Jack,

Seems I know what's the problem
In your code you use myMSMQueue.Path = (@".\private$\incoming"); - it *initialize*
already created queue, but I can't find
where u create queue

use MessageQueue myMSMQueue = MessageQueue.Create(@".\private$\incoming");

and then send data

J> No, it is created by an application that I installed.
J> I created a manual queue and the code works with the manual queue but
J> does not work with this one. What do I look at in the queue to
J> resolve this one?

[quoted text, click to view]

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

Michael Nemtsev
2/7/2006 12:00:00 AM
Hello Jack,

Do you wanna put message into your local intranet MQ from the web or do you
want interact in the web with asycn messages?
For the first you can use WebServices as the endpoint - you send message
to webService and it put your message in local intranet MQ
The second now in not possible in the pure aspect of MQ. Indigo (WCF) will
realise these features, but now we can be only a bit close to this using
WS-ReliableMessaging - it gives u feature of message persistene, but don't
affect wire protocol
Moreover there is one alternative realization MQ for Web - WSMQ (http://www.wsmq.com/)
but I haven't use it yet and don't know its features

J> I fixed the issue. Thank you for your help.
J>
J> I am trying to receive this xml file from my customer. How do I set
J> up the receiver to receive this file over the web? Any code example
J> will be appreciated.

[quoted text, click to view]

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

AddThis Social Bookmark Button