Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
IBM MQ的.Net AMQP客户端_.net_Node.js_Ibm Mq_Amqp - Fatal编程技术网

IBM MQ的.Net AMQP客户端

IBM MQ的.Net AMQP客户端,.net,node.js,ibm-mq,amqp,.net,Node.js,Ibm Mq,Amqp,我正在尝试从.Net应用程序使用AMQP1.0通道连接到IBM MQ 9.0 MQ Light portal目前仅支持Nodejs、ruby、java和python客户端。我们是否有针对.Net的MQ Light AMQP客户端 我已尝试使用Amqpnetlite客户端连接到IBM MQ 9 namespace AMQPNetLiteSample { class Program { static void Main(string[] args) {

我正在尝试从.Net应用程序使用AMQP1.0通道连接到IBM MQ 9.0

MQ Light portal目前仅支持Nodejs、ruby、java和python客户端。我们是否有针对.Net的MQ Light AMQP客户端

我已尝试使用Amqpnetlite客户端连接到IBM MQ 9

namespace AMQPNetLiteSample
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Start");
            //Address addr = new Address("10.58.139.97", 1234, "Username","password", "/", "AMQP");
            Address addr = new Address("amqp://10.58.139.97:1234");

            Connection con = new Connection(addr);
            con.Closed += con_Closed;
            Console.WriteLine("Created connection");

            Session session = new Amqp.Session(con);
            session.Closed += session_Closed;
            Console.WriteLine("Created session");

            SenderLink link = new SenderLink(session, "sender_12565455877", "/public");
            Console.WriteLine("Created link");
            var message = new Message();
            message.Properties = new Properties();
            message.Properties.Subject = "mysamplemsg";
            message.ApplicationProperties = new ApplicationProperties();
            message.ApplicationProperties["myprop"] = "Hello World";
            Console.WriteLine("sending message");
            link.Send(message);

        }

        static void session_Closed(AmqpObject sender, Error error)
        {
            Console.WriteLine("Session closed");
            Console.WriteLine(error.ToString());
        }

        static void con_Closed(AmqpObject sender, Error error)
        {
            Console.WriteLine("Connection closed");
            Console.WriteLine(error.ToString());
        }
    }
}
但我没能成功地建立起联系。启动SenderLink时,我得到2035 MQRC_NOT_AUTHORIZED异常。 但是,在IBM MQ 9.0服务器中不更改任何通道身份验证的情况下,如果我使用MQ Light nodejs示例(send.js)进行尝试,我就能够连接并向AMQP通道发送消息

请说明上述代码是否需要更改


是否有人成功地与IBM MQ建立了与任何其他.Net 1.0 AMQP客户端的通信?这里需要你的帮助。谢谢。

似乎即使未配置用户名和密码,MQ代理也需要SASL协商连接。您可以在amqpnetlite上启用SASL Anonymous,如下所示

Address address = new Address("amqp://10.58.139.97:1234");
Connection connection = new Connection(address, SaslProfile.Anonymous, null, null);
Session session = new Session(connection);
SenderLink sender = new SenderLink(session, "sender-12345", "/public");
Message message = new Message("Hello");
message.Properties = new Properties() { MessageId = "msg", To = "q1" };
sender.Send(message);
connection.Close();
也可以对ConnectionFactory执行相同的操作

Address address = new Address("amqp://10.58.139.97:1234");
var factory = new ConnectionFactory();
factory.SASL.Profile = SaslProfile.Anonymous;
Connection connection = await factory.CreateAsync(address);

理论上,任何AMQP客户机都应该工作。您可以在MQ队列管理器的错误日志中找到有关未授权的原因的详细信息。(AMQERR01.LOG)您应该在GitHub站点上发布此消息,并附带示例代码。当前的示例代码没有提到此要求。