标签:
//MSMQ path
string qPath = ".\\private$\\fids_input";
//send msg to Q
public void sendMsg(string content)
{
try
{
System.Text.UTF8Encoding oEncoder = new System.Text.UTF8Encoding();
MessageQueue msgQ = new MessageQueue(qPath);
System.Messaging.Message msg = new System.Messaging.Message();
msg.Label = "PARSRqeuest";
//msg.Formatter = new XmlMessageFormatter(new Type[] { typeof(string) });
//发消息到队列中
System.IO.MemoryStream ms = new System.IO.MemoryStream(oEncoder.GetBytes(content));
msg.BodyStream = ms;
msg.UseDeadLetterQueue = false;
msg.UseJournalQueue = false;
msgQ.Send(msg);
msg = null;
msgQ.Close();
msgQ = null;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
标签:
原文地址:http://www.cnblogs.com/lsp003/p/4825552.html