编程语言
首页 > 编程语言> > c# – IBM MQSeries问题:远程主机在写消息时关闭连接(错误10054)

c# – IBM MQSeries问题:远程主机在写消息时关闭连接(错误10054)

作者:互联网

我正在尝试使用以下命令写入IBM MQSeries主机:

public void WriteMessage(string message)
{
    queueMessage = new MQMessage();
    queueMessage.WriteString(message);
    queueMessage.Format = MQC.MQFMT_STRING;
    queuePutMessageOptions = new MQPutMessageOptions();

    queue.Put(queueMessage, queuePutMessageOptions);
}

我的错误捕获给了我一个错误:

Error in the application

当然没有太多表现.所以我检查了服务器上的事件日志,这显示了错误:

An error occurred receiving data from
stx041774 (192.168.225.51) over
TCP/IP. This may be due to a
communications failure.

06001

Record these values and tell the
systems administrator.

我抬头看了10054,意思是:

An existing connection was forcibly
closed by the remote host.

有谁知道我能做些什么来使这项工作?是否有一个我必须设置写入的MQC选项?因为我不知道如何处理选项,我甚至不确定这是否是问题.

解决方法:

我用选项mqc.mqoo_output解决了这个问题:

queue = qManager.AccessQueue(QueueName, MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING);

标签:c,ibm-mq
来源: https://codeday.me/bug/20190701/1343603.html