簡體   English   中英

IBM MQ Server安裝程序以創建.NET Client使用的CCDT文件

[英]IBM MQ Server Setup to Create CCDT file used by .NET Client

我需要對MQ.NET客戶端使用CCDT文件才能連接到MQ Server,兩者都在本地運行,但是下面出現錯誤。

IBM.WMQ.MQException: MQRC_Q_MGR_NAME_ERROR CompCode: 2, Reason: 2058

請在下面的服務器設置和MQ.NET客戶端中找到。

服務器設置

我通過以下鏈接設置並創建了CCDT文件:

使用IBM MQ資源管理器設置服務器

服務器連接通道:LOCAL.DEF.SVRCONN

MCA用戶ID:我嘗試省略它或提供它。 mqm的成員之一,也可以不是。

使用IBM MQ Explorer設置客戶機

Clinet頻道:LOCAL.DEF.SVRCONN

隊列管理器名稱:LocalQM

連接名稱:192.168.1.9(1415)

192.168.1.9是本地主機地址

1415是隊列管理器, LocalQM ,TCP端口。

IBM MQ.NET

代碼從這里下面

        MQQueueManager qm = null;
        System.Environment.SetEnvironmentVariable("MQCHLLIB", "C:\\ProgramData\\IBM\\MQ\\qmgrs\\LocalQM\\@ipcc");
        System.Environment.SetEnvironmentVariable("MQCHLTAB", "AMQCLCHL.TAB");

        try
        {
            Hashtable props = new Hashtable();
            props.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT);
            qm = new MQQueueManager("LocalQM",props);
            MQQueue queue1 = qm.AccessQueue("LocalQueue", MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING);
            MQMessage msg = new MQMessage();
            msg.WriteUTF("Hello this message is from .net client");
            queue1.Put(msg);
            queue1.Close();
            qm.Disconnect();
        }
        catch (Exception ex)
        {
            Console.Write(ex);
        }

Windows 10上的IBM MQ V8

Windows 10上的MQ.NET Client V8

創建客戶渠道定義表

在.NET中使用客戶端通道定義表

UPDATE

如果我不使用CCDT更改為以下內容,則可以使用。

   var properties = new Hashtable
        {
            {MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED },         
             { MQC.HOST_NAME_PROPERTY, "192.168.1.9" }, //"localhost" },
        { MQC.PORT_PROPERTY, "1415"},
        { MQC.CHANNEL_PROPERTY, "LOCAL.DEF.SVRCONN" },
            {MQC.USER_ID_PROPERTY, "xxx" },  //usrename
            {MQC.PASSWORD_PROPERTY, "xxx" }  //password
        };
        _queueManager = new MQQueueManager(_queueManagerName, properties);

更新2我將隊列管理器更改為LocalQM

C:\Users\'#.lp\source>SET MQCHLLIB=C:\ProgramData\IBM\MQ\qmgrs\LocalQM\@ipcc

C:\Users\'#.lp\source>SET MQCHLTAB=AMQCLCHL.TAB

C:\Users\'#.lp\source>echo DIS CHL(LOCAL.DEF.SVRCONN) CHLTYPE(CLNTCONN) ALL | runmqsc -n
5724-H72 (C) Copyright IBM Corp. 1994, 2015.
Starting local MQSC for 'AMQCLCHL.TAB '.

     1 : DIS CHL(LOCAL.DEF.SVRCONN) CHLTYPE(CLNTCONN) ALL
AMQ8414: Display Channel details.
   CHANNEL(LOCAL.DEF.SVRCONN)              CHLTYPE(CLNTCONN)
   AFFINITY(PREFERRED)                     ALTDATE(2018-04-16)
   ALTTIME(22.16.03)                       CERTLABL( )
   CLNTWGHT(0)                             COMPHDR(NONE)
   COMPMSG(NONE)                           CONNAME(192.168.1.9 (1415))
   DEFRECON(NO)                            DESCR( )
   HBINT(300)                              KAINT(AUTO)
   LOCLADDR( )                             MAXMSGL(4194304)
   MODENAME( )                             PASSWORD( )
   QMNAME(LocalQM)                         RCVDATA( )
   RCVEXIT( )                              SCYDATA( )
   SCYEXIT( )                              SENDDATA( )
   SENDEXIT( )                             SHARECNV(10)
   SSLCIPH( )                              SSLPEER( )
   TPNAME( )                               TRPTYPE(TCP)
   USERID( )
No commands have a syntax error.

C:\Users\'#.lp\source>

更新3:MQRC_NOT_AUTHORIZED未解決

我變了

  1. 192.168.1.9(1415)-> 192.168.1.9(1415)
  2. 將AMQCLCHL.TAB也放到C:\\ ProgramData \\ IBM \\ MQ(我不知道為什么這可能不正確,因為日志文件上的錯誤:

    AMQ9518:找不到文件'C:\\ ProgramData \\ IBM \\ MQ \\ AMQCLCHL.TAB'。

3我嘗試了MCA用戶ID->

1位是mqm成員的mqlclient

不是mqm成員的2個mqlclient

3空

但是仍然有錯誤。 以下是3.1的異常和錯誤

IBM.WMQ.MQException: MQRC_NOT_AUTHORIZED

----- cmqxrsrv.c : 2356 -------------------------------------------------------
17/04/2018 23:50:44 - Process(1848.16) User(SYSTEM) Program(amqzlaa0.exe)
                      Host(APPLE) Installation(Installation1)
                      VRMF(8.0.0.5) QMgr(LocalQM)

AMQ5540: Application 'bin\Debug\Producer.exe' did not supply a user ID
and password

EXPLANATION:
The queue manager is configured to require a user ID and password, but none was
supplied.
ACTION:
Ensure that the application provides a valid user ID and password, or change
the queue manager configuration to OPTIONAL to allow applications to connect
which have not supplied a user ID and password. 
----- amqzfuca.c : 4311 -------------------------------------------------------
17/04/2018 23:50:44 - Process(1848.16) User(SYSTEM) Program(amqzlaa0.exe)
                      Host(APPLE) Installation(Installation1)
                      VRMF(8.0.0.5) QMgr(LocalQM)

AMQ5541: The failed authentication check was caused by the queue manager
CONNAUTH CHCKCLNT(REQDADM) configuration.

EXPLANATION:
The user ID 'mqclient' and its password were checked because the user ID is
privileged and the queue manager connection authority (CONNAUTH) configuration
refers to an authentication information (AUTHINFO) object named
'SYSTEM.DEFAULT.AUTHINFO.IDPWOS' with CHCKCLNT(REQDADM). 

This message accompanies a previous error to clarify the reason for the user ID
and password check.
ACTION:
Refer to the previous error for more information. 

Ensure that a password is specified by the client application and that the
password is correct for the user ID. The authentication configuration of the
queue manager connection determines the user ID repository. For example, the
local operating system user database or an LDAP server. 

To avoid the authentication check, you can either use an unprivileged user ID
or amend the authentication configuration of the queue manager. You can amend
the CHCKCLNT attribute in the CHLAUTH record, but you should generally not
allow unauthenticated remote access. 
-------------------------------------------------------------------------------
17/04/2018 23:50:45 - Process(14900.9) User(SYSTEM) Program(amqrmppa.exe)
                      Host(APPLE) Installation(Installation1)
                      VRMF(8.0.0.5) QMgr(LocalQM)

AMQ9557: Queue Manager User ID initialization failed for 'mqclient'.

EXPLANATION:
The call to initialize the User ID 'mqclient' failed with CompCode 2 and Reason
2035.
ACTION:
Correct the error and try again. 
----- cmqxrsrv.c : 2356 -------------------------------------------------------

OP在UPDATE 2問題中添加了以下信息:

  1. SET MQCHLLIB=C:\\ProgramData\\IBM\\MQ\\qmgrs\\QM1\\@ipcc
  2. SET MQCHLTAB=AMQCLCHL.TAB
  3. echo DIS CHL(LOCAL.DEF.SVRCONN) CHLTYPE(CLNTCONN) ALL | runmqsc -n

我發現CCDT有兩個可能的問題:

  1. IP和開放括號之間的CONNAME有一個空格。 這可能導致MQ忽略端口1415並使用默認端口1414,它也可能會忽略該空間,這可能不是問題,我從未測試過空間。

     COMPMSG(NONE) CONNAME(192.168.1.9 (1415)) 
  2. CLNTCONN通道的QMNAME應該與您在對new MQQueueManager的調用中指定的名稱匹配,因此應該說QM1不是LocalQM ,這可能是2058錯誤的直接原因,但是一旦修復,#1也可能會引起問題#2。

     QMNAME(LocalQM) RCVDATA( ) 

QMNAME還有其他用途,您可以在其中指定組名或空白。 有關此的更多詳細信息,請參見我對“ 使用JMS中的CCDT文件連接到IBM MQ ”的回答。 答案與JMS有關,但為setQueueManager提供的信息將與您對new MQQueueManager的調用的第一個參數相同。

通常,原因碼2058(MQRC_Q_MGR_NAME_ERROR)表示您具有無效的隊列管理器名稱,或者服務器沒有該特定的隊列管理器。 檢查您輸入的隊列管理器名稱的拼寫。 另外,隊列管理器名稱區分大小寫(例如,MQA1與mqa1不同)。

而且,每個隊列管理器都將有其自己的端口號。 例如1414、1415、1416等。因此,如果該服務器上正在運行多個隊列管理器,請確保您使用的端口正確。

System.Environment.SetEnvironmentVariable("MQCHLLIB", "C:\\ProgramData\\IBM\\MQ\\qmgrs\\QM1\\@ipcc");
System.Environment.SetEnvironmentVariable("MQCHLTAB", "AMQCLCHL.TAB");

在啟動程序之前,請嘗試設置環境變量,而不要從程序內部進行設置。 我在Windows和/或.NET中發現了在程序中設置環境變量的怪異問題-有時可行,有時卻不可行。

最后,您是否將應用程序與隊列管理器在同一服務器上運行? 如果是這樣,則以“綁定模式”而不是“客戶端模式”連接。 綁定模式將更快,因為不涉及網絡。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM