Environment:.NET 4.0, MQ.NET client IBm.xMS (V2.0.0.3)
The test code is as follows:
var factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); var _connFactory = factoryFactory.CreateConnectionFactory(); _connFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, "192.168.0.65"); _connFactory.SetIntProperty(XMSC.WMQ_PORT, 1414); _connFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, "XPP_QM"); _connFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); _connFactory.SetIntProperty(XMSC.WMQ_BROKER_VERSION, XMSC.WMQ_BROKER_V1); _connFactory.SetStringProperty(XMSC.CLIENT_ID, string.Empty); var conn = _connFactory.CreateConnection(); conn.Start();
Error:
IBM. XMS. XMSException: CWSMQ0006E: method is called ConnectionFactory. Abnormal received during the CreateConnection: CompCode: 2, Reason: 2538
. During the execution of the specified method, another component throws an exception. For more information, see Linked Exceptions. .
in the IBM XMS. Client. WMQ. WmqConnectionFactory. CreateProviderConnection (XmsPropertyContext connectionProps)
in the IBM, XMS. Client. Impl. XmsConnectionFactoryImpl. The CreateConnection (String userID. String password)
in the IBM, XMS. Client. Impl. XmsConnectionFactoryImpl. The CreateConnection ()
in XRisk. MQ. MQConnection. Open (Boolean needLog) location e: \ xRisk4 – SRC \ XRisk MQ \ MQConnection cs: line number 314
Linked Exception : CompCode: 2, Reason: 2538
The real exception is reported in the following code.
IBM.WMQ.MQTCPConnection ---- < ParseLocalAddress(String) exit [o] rc=OK IBM.WMQ.MQTCPConnection --- d Exception in method ConnectSocket(string,string,MQLONG) IBM.WMQ.MQTCPConnection --- X System.Net.Sockets.SocketException (0x80004005): The requested name is valid and was found in the database, but it does not have the correct associated data being resolved for at System.Net.Dns.InternalGetHostByAddress(IPAddress address, Boolean includeIPv6) at System.Net.Dns.GetHostEntry(String hostNameOrAddress) at IBM.WMQ.MQTCPConnection.ConnectSocket(String localAddr, String connectionName, Int32 options) MQException CompCode: 2 Reason: 2538
The real reason is that in.NET 4.0, Microsoft changed the behavior of the interface Dns.GetHostEntry. When IP is used directly as a parameter, the report is not reported if the machine name or domain name is used.
The solution is as follows
1. Use ipAddres.tryparse () or Dns.Resolve(String) instead of Dns.GetHostEntry.
2. If you are using a third-party library and cannot modify the code, you can use the MACHINE name or domain name code for the IP. The above code can be changed to.
var factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); var _connFactory = factoryFactory.CreateConnectionFactory(); _connFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, "hostname"); _connFactory.SetIntProperty(XMSC.WMQ_PORT, 1414); _connFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, "XPP_QM"); _connFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT); _connFactory.SetIntProperty(XMSC.WMQ_BROKER_VERSION, XMSC.WMQ_BROKER_V1); _connFactory.SetStringProperty(XMSC.CLIENT_ID, string.Empty); var conn = _connFactory.CreateConnection(); conn.Start();
Reference:
http://connect.microsoft.com/VisualStudio/feedback/details/561083/dns-gethostentry-behaves-differently-in-net-4-0-than-previous-versions
http://stackoverflow.com/questions/2714449/problem-with-system-net-dns-gethostentrydnsserver-on-net-4-0
https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014538533#77777777-0000-0000-0000-000014538832
Reproduced in: https://www.cnblogs.com/jmax/p/3494320.html
Read More:
- The reason and solution of Android intent value not updated
- In Vue, use echorts to report an error: “typeerror: cannot read property ‘init’ of undefined” error reporting reason and solution
- Reason: error reading from remote server
- reason 442 failed to enable virtual adapter
- The reason of OpenGL configuration error in VS
- [solved] sql30082n security processing failed with reason “24” (“user name and / or password invalid”)
- The reason of error in R file
- Reason for error in idea @ springbootapplication [solved]
- appear java.lang.NoClassDefFoundError A kind of reason and solution of the mistake
- Tomcat opens the startup.bat The reason for the flash
- Connection authorization failure occurred. Reason: local security service non retryable error solution
- About the reason why the Raspberry Pi raspistill command cannot find the camera
- The reason and solution of the error of join function: sequence item 0: expected STR instance, int found
- Solved: elasticsearch error: exception [type = search]_ phase_ execution_ exception, reason=all shards failed]
- DirectX encountered “unresolved external symbol” when compiling on vs2015__ The solution and reason of “vsnwprintf”
- Error lnk2038: detected “0”_ ITERATOR_ DEBUG_ The reason and solution of the unmatched item of “level”
- The reason why HashMap multithreads send out life and death loops
- 【MongoDB】 Failed to connect to 127.0.0.1:27017, reason: Connection refused
- circuit_breaking_exception,“reason“:“[parent] Data too large, data for [<http_request>]
- error:Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused;error:couldn‘t ….