//測試環境說明
//1,發送與接收應用程序客戶端:window2003 server, window2000 server,window xp;
//2,msmq server :window2003 server +活動目錄(已經為msmq消息隊列的everynone帳戶設置了所有權限)
//消息發送測試代碼
try
???{
????System.Messaging.MessageQueue Queue;
????Queue = new System.Messaging.MessageQueue(@"FormatName:DIRECT=TCP:172.26.230.2\ptest1");
????
????System.Messaging.Message Msg;
????Msg = new System.Messaging.Message();
????Msg.Formatter =new System.Messaging.BinaryMessageFormatter();
????Msg.Body="Testing 3 times";
????Queue.Send(Msg);
???}
???catch(Exception ex)
???{
????System.Windows.Forms.MessageBox.Show(ex.ToString());
???}??
//消息接收測試代碼
try
???{
????System.Messaging.MessageQueue mq = new System.Messaging.MessageQueue(@"FormatName:DIRECT=tcp:172.26.230.2\ptest1");
????// Set the queue'ss formatter to decode Point objects
????mq.Formatter = new System.Messaging.BinaryMessageFormatter();
????System.Messaging.Trustee trustee=new System.Messaging.Trustee();
????
????System.Messaging.Message msg = mq.Peek ( new TimeSpan(10000)) ;
????// Convert received message to object that we think was sent
????string pt = (string) msg.Body ;
????// Display it to the user
????
????MessageBox.Show (pt) ;
???}
???catch(Exception ex)
???{
????MessageBox.Show(ex.ToString());
???}
//運行結果說明
//1, 所有操作系統類型的客戶端向遠程msmq服務器發送消息成功
//2,window2000環境下從遠程服務器接收消息成功
//?? window xp客戶端接收失敗
//?? window 2003(未安裝活動目錄)部分客戶端接收成功,部分失敗
//?? window 2003(安裝活動目錄)所有客戶端接收消息失敗????
//3,異常訊息如下:
/*
---------------------------
System.Messaging.MessageQueueException
?? at System.Messaging.MQCacheableInfo.get_ReadHandle()
?? at System.Messaging.MessageQueue.StaleSafeReceiveMessage(UInt32 timeout, Int32 action, MQPROPS properties, NativeOverlapped* overlapped, ReceiveCallback receiveCallback, IntPtr cursorHandle, IntPtr transaction)
?? at System.Messaging.MessageQueue.ReceiveCurrent(TimeSpan timeout, Int32 action, IntPtr cursor, MessagePropertyFilter filter, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType)
?? at System.Messaging.MessageQueue.Peek(TimeSpan timeout)
?? at InternetQueueingRecipient.Form1.button2_Click(Object sender, EventArgs e) in c:\msmqandnet\msmqandnet\internetqueuing\internetqueueingrecipient\form1.cs:line 294
*/
疑問:msmq3.0遠程接收消息時,客戶端要做何種配置,服務器端要做何種配置?原因與原理?msmq遠程讀取消息的使用的默認帳戶為
什么?
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
