我有一個VB.NET控制檯應用程序,它必須將消息寫入隊列(駐留在大型機上)。我們擁有所有的集羣和我們的管理員設置的所有內容。我們已經有了一個現有的Windows服務,它可以成功地偵聽消息並將消息寫入各種隊列。從.NET訪問MQ時出錯
我已經基本上重新使用了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
'記錄這些值並告訴系統管理員 – 2012-03-15 18:36:34