私はWindowsアプリケーションを持っています。アプリケーションは、MS メッセージ キューイングからメッセージを読み取ります。アプリケーションの問題は、メッセージキューからメッセージを読み取らず、この例外をスローすることがあります。
Thread was being aborted.
at System.Messaging.Interop.UnsafeNativeMethods.MQReceiveMessage(MessageQueueHandle handle, UInt32 timeout, Int32 action, MQPROPS properties, NativeOverlapped* overlapped, ReceiveCallback receiveCallback, CursorHandle cursorHandle, IntPtr transaction)
at System.Messaging.MessageQueue.StaleSafeReceiveMessage(UInt32 timeout, Int32 action, MQPROPS properties, NativeOverlapped* overlapped, ReceiveCallback receiveCallback, CursorHandle cursorHandle, IntPtr transaction)
at System.Messaging.MessageQueue.ReceiveCurrent(TimeSpan timeout, Int32 action, CursorHandle cursor, MessagePropertyFilter filter, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType)
at System.Messaging.MessageQueue.Receive()
at Catalyst.CATS.DBService.OrdersQueueHandler.SynReceiveThreadMethod() in D:\svn\kinetic\Servers\Main DB Service\trunk\MainDatabaseServiceGUI\DBMainLogic\classes\OrdersQueueHandler.cs:line 143
問題がわかりません 助けてください
以下に、アプリケーションの短いコード例を示します。
public class Messages
{
private MessageQueue OrdersQueue;
OrdersQueue = MessageQueue.Create(".\\Private$\\DatabaseServerQueue", false);
OrdersQueue.SetPermissions("Everyone", System.Messaging.MessageQueueAccessRights.FullControl);
OrdersQueue.SetPermissions("ANONYMOUS LOGON", System.Messaging.MessageQueueAccessRights.FullControl);
OrdersQueue.UseJournalQueue = true;
public Messages()
{
thd = new Thread(new ThreadStart(SynReceiveThreadMethod));
thd.Start();
}
private void SynReceiveThreadMethod()
{
while(true)
{
try
{
Message dequeuedMessage = OrdersQueue.Receive();
}
catch (Exception ee)
{
System.Console.WriteLine(ee.Message);
System.Console.WriteLine(ee.StackTrace);
}
}
}
}