发送消息队列问题,急!!!高分求助
以下代码为把DATASET写入STREAM
DataSet SendDs = new DataSet();
SendDs.Tables.Add(SendDt);
SendDs.DataSetName = "Info";
SendDs.WriteXml(SendStream);
Send_Info(MqPath, LabelStr, SendStream);
以下为发送消息队列的方法
private void Send_Info(string MQPath, string Label, Stream Info)
{
try
{
MessageQueueTransaction Mqt = new MessageQueueTransaction();
MessageQueue Mq = new MessageQueue(MQPath);
Message Msg = new Message();
Msg.Formatter = new System.Messaging.XmlMessageFormatter(new Type[] { typeof(XmlDocument) });
Msg.Label = Label;
Msg.Body = Info;
Mqt.Begin();
try
{
Mq.Send(Msg, Mqt); }
catch (Exception ex)
{
Mqt.Abort();
throw ex;
}
Mqt.Commit();
}
catch (Exception ex)
{
throw new Exception("SendMQ在发送Mq时出现错误", ex);
}
}
Mq.Send(Msg, Mqt);时发生异常
“SendStream.ReadTimeout”引发了“System.InvalidOperationException”类型的异常
“SendStream.WriteTimeout”引发了“System.InvalidOperationException”类型的异常
用DS写成XML文件无问题。