0
我有Windows應用程序。應用程序從MS 消息隊列中讀取消息。應用程序中的問題是有些時候不要從消息隊列讀取消息並拋出此異常。Microsoft Message Queue
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
我不能找出問題plz幫助我走出
下面我有我的應用程序的短代碼示例。
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);
}
}
}
}
沒有點發布異常沒有導致它的代碼... – JuStDaN
沒有足夠的細節來找出真正的例外。請發佈您正在使用的ENTIRE異常和代碼以從隊列中讀取消息。您也可能發現使用跟蹤日誌記錄有幫助。 http://msdn.microsoft.com/en-us/library/ms751526.aspx或 –
什麼是異常消息?這看起來只是堆棧跟蹤的一部分。 –