我有一个VB.NET控制台应用程序,必须将消息写入队列(驻留在大型机上)。我们拥有所有集群和管理员设置的所有内容。我们已经有一个成功监听消息的现有Windows服务,并且还将消息写入各种队列。
我基本上已经重新使用了Windows服务项目中的大部分代码。
但是当我尝试访问队列管理器时,我遇到异常“MQRC_HOST_NOT_AVAILABLE”。 Websphere MQ文件夹中的错误日志显示
AMQ9213: A communications error for occurred.
EXPLANATION:
An unexpected error occurred in communications.
ACTION:
The return code from the call was 0 (X'0'). Record these values and tell the systems administrator.
这是完整的异常堆栈。
IBM.WMQ.MQException was unhandled
Message="MQRC_HOST_NOT_AVAILABLE"
Source="amqmdnet"
StackTrace:
at IBM.WMQ.MQBase.throwNewMQException()
at IBM.WMQ.MQQueueManager.Connect(String queueManagerName)
at IBM.WMQ.MQQueueManager..ctor(String queueManagerName)
at LPMQtoClarify.Module1.Main() in D:\LPDEV\Developers\X173036_Santhanam\LPMQtoClarify\LPMQtoClarify\Module2.vb:line 47
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
这是我的代码的一部分。例外情况发生在以下行
中QueueManager = New MQQueueManager(TransParmRec.MQManager)
感谢任何帮助。感谢。
Dim pos As Integer = 3
Dim clarifyReturnCode As Integer = 0
Dim clarifyRequestMessage As String = String.Empty
Dim QueueManager As MQQueueManager
clarifyQLauncherName = ConfigurationManager.AppSettings.[Get]("MQ_CLARIFY_REQUEST_Q")
Dim initRetCode As Integer = 0
Dim errorMessage As String = ""
initRetCode = GetTransInfo(TransParmRec, dbConnectionString, errorMessage)
MQEnvironment.Hostname = TransParmRec.MQHostName
MQEnvironment.Channel = TransParmRec.MQChannel
If TransParmRec.PortNumber.ToString().Length > 0 Then
MQEnvironment.Port = Convert.ToInt32(TransParmRec.PortNumber)
End If
If TransParmRec.SecExit.ToString().Length > 0 Then
MQEnvironment.SecurityExit = TransParmRec.SecExit
End If
QueueManager = New MQQueueManager(TransParmRec.MQManager)
Using sw As New StreamWriter("C:\FCLARIFYMQ.REQ", True)
If QueueManager Is Nothing Then
sw.WriteLine("Queue Manager is null")
Else
sw.WriteLine("Queue Manager is not null")
End If
End Using
答案 0 :(得分:0)
重新检查您的主机名或端口号。如果主机名或端口号无效,则返回MQRC_HOST_NOT_AVAILABLE。
答案 1 :(得分:0)
当我在不同的用户帐户下运行应用程序时,代码有效。 MQ权限是为不同的用户帐户设置的,该帐户与管理员帐户不同。