By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,977 Members | 1,638 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,977 IT Pros & Developers. It's quick & easy.

cannot post to MSMQ from dotnet code

P: n/a
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();

}
}
}
Feb 5 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.