クライアントが変更を含むmsmqメッセージをサーバーアプリケーションに送信するマルチユーザー計画アプリケーションを持っています。サーバーアプリケーションはそれらを処理し、在庫/時間不足を計算し、接続されているすべてのクライアントにデータを更新して変更を表示するようにメッセージを送信します。
これは、私を悩ませ続ける1つの例外を除いて、かなりうまく機能しています。
これは基本的に、起動直後の一部の高速 PC (SSD、I7 など) でのみ発生します。
ExceptionInformation: System.Messaging.MessageQueueException
Stack:
at System.Messaging.MessageQueue+MQCacheableInfo.get_ReadHandle()
at System.Messaging.MessageQueue.StaleSafeReceiveMessage(UInt32, Int32, MQPROPS, System.Threading.NativeOverlapped*, ReceiveCallback, System.Messaging.Interop.CursorHandle, IntPtr)
at System.Messaging.MessageQueue.ReceiveCurrent(System.TimeSpan, Int32, System.Messaging.Interop.CursorHandle, System.Messaging.MessagePropertyFilter, System.Messaging.MessageQueueTransaction, System.Messaging.MessageQueueTransactionType)
at System.Messaging.MessageQueue.Receive()
at Europlanner_.MSMQHandler.ReceiveMessage()
at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
at System.Threading.ExecutionContext.runTryCode(System.Object)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
起動後 1 分ほどでアプリケーションを開くと、エラーは表示されません。これは実際にはゲームを壊すバグではありませんが、修正したいと思います。
私は例外をいくつか検索しましたが、それはパーミッションと関係があると推測していますが、ブート直後にのみ発生するのは奇妙です.
テスト目的で、Everyone と Anonymous Log-on が完全に制御できるように、キューにアクセス許可を設定してみました。しかし、それは役に立たないようです。
マシンはすべて同じドメインにあり、キューはドメイン内のサーバーの 1 つにあります。
例外が発生するコードは次のとおりです。
Private Sub ReceiveMessage()
While KeepReading
Dim MSG As Message = ClientQue.Receive()
If Not DateDiff(DateInterval.Minute, MSG.SentTime, Now) >= 1 Then
HandleMessage(MSG)
Else : DebugHandler.WriteLine(DebugTypes.Network, "Removed MSMQ message due to age. (Older than 1 minute") : End If
LastServerCommunication = 0
End While
End Sub
私自身のマシンはユーザーのマシンよりも少し古くて遅く、個人的には自分のマシンでバグを再現できないようです。ユーザーのマシンをテストに使用できる期間は限られています。
この例外の原因について考えている人はいますか?
追加情報を投稿する必要がある場合は、お尋ねください。
ご清聴ありがとうございました。
Kjell-Åke の質問に答えるために編集します。
この小さな関数を使用して、サービスが開始されているかどうかを確認します。
Private Function QueueServiceStarted() As Boolean
Dim Services As List(Of ServiceController) = ServiceController.GetServices().ToList
Dim MSMQueue As ServiceController = Services.Find(Function(o) o.ServiceName = "MSMQ")
If Not MSMQueue Is Nothing Then If MSMQueue.Status = ServiceControllerStatus.Running Then Return True
Return False
End Function
編集して例外メッセージを追加します。
"Unable to establish connection with Active Directory Domain Services. Verify that there are sufficient permissions to perform this operation."
編集:さらに情報を追加する
アプリケーションは、Windows ログで次のイベントの後に動作しているようです。
"The Message Queuing service is online with Active Directory and fully operational."
したがって、基本的には、質問は次のように変わると思います。より高速な PC では、なぜそれが起こるのにそれほど時間がかかるのですか?