我是 MSMQ 的新手,正在尝试将 XML 消息发送到远程事务队列。两台机器都是2003服务器。我可以让它与非事务性远程队列一起工作。我似乎无法将消息放到事务队列中。C# 代码如下。我没有收到它从未出现过的错误。
Message rqMessage = new Message();
System.Xml.Serialization.XmlSerializer ser = new System.Xml.Serialization.XmlSerializer( typeof([message type]));
XmlTextWriter writer = new XmlTextWriter(rqMessage.BodyStream, Encoding.UTF8);
ser.Serialize(writer, rqDoc);
rqMessage.Label = "message label";
rqMessage.TimeToBeReceived = Message.InfiniteTimeout;
rqMessage.TimeToReachQueue = Message.InfiniteTimeout;
rqMessage.ResponseQueue = new MessageQueue("Path");
rqMessage.Formatter = new ActiveXMessageFormatter();
MessageQueue rqQueue = new MessageQueue(nodeRequestQueue.SelectSingleNode("Path").InnerText);
bool transactional = false;
try
{
transactional = rqQueue.Transactional;
}
catch(MessageQueueException)
{
transactional = false;
}
if ( transactional )
rqQueue.Send(rqMessage, MessageQueueTransactionType.Single);
else
rqQueue.Send(rqMessage);