在测试msmq3.0的消息队列传输功能中,遇到以下问题:
1,应用场景,
客户端程序需要从远端消息队列服务器的消息队列中读取一条消息。
2,代码,
try
{
System.Messaging.MessageQueue mq = new System.Messaging.MessageQueue("FormatName:DIRECT=http://localhost/msmq/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.MessageQueueAccessControlEntry ace = new System.Messaging.MessageQueueAccessControlEntry(trustee, System.Messaging.MessageQueueAccessRights.FullControl);
mq.SetPermissions(ace);
// Before playing with the message here, call our own utility
// Receive message with timeout interval specified by user
System.Messaging.Message msg = mq.Peek ( new TimeSpan(0,0,0)) ;
// 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());
}
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.Receive(TimeSpan timeout) at InternetQueueingRecipient.Form1.button1_Click(Object sender, EventArgs e) in c:\msmqandnet\msmqandnet\internetqueuing\internetqueueingrecipient\form1.cs:line 189
---------------------------
确定
---------------------------问题,mq本身是否不允许从远端服务器读取消息?
拜各位大小赐教!
1,应用场景,
客户端程序需要从远端消息队列服务器的消息队列中读取一条消息。
2,代码,
try
{
System.Messaging.MessageQueue mq = new System.Messaging.MessageQueue("FormatName:DIRECT=http://localhost/msmq/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.MessageQueueAccessControlEntry ace = new System.Messaging.MessageQueueAccessControlEntry(trustee, System.Messaging.MessageQueueAccessRights.FullControl);
mq.SetPermissions(ace);
// Before playing with the message here, call our own utility
// Receive message with timeout interval specified by user
System.Messaging.Message msg = mq.Peek ( new TimeSpan(0,0,0)) ;
// 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());
}
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.Receive(TimeSpan timeout) at InternetQueueingRecipient.Form1.button1_Click(Object sender, EventArgs e) in c:\msmqandnet\msmqandnet\internetqueuing\internetqueueingrecipient\form1.cs:line 189
---------------------------
确定
---------------------------问题,mq本身是否不允许从远端服务器读取消息?
拜各位大小赐教!
解决方案 »
- 一个数据包传送的奇怪问题
- C# ActiveX插件问题(开启IE后IE自动关闭) 顶者有分
- 请教如何获取IIS的客户端信息
- [疑问]垃圾回收、托管堆、栈的涵义
- 我是菜鸟,c#字符型转换为数值型,怎么写?
- 郁闷!不知该学什么了!请大家帮我参考参考!
- 怀疑sql语句有错误,但sql语句是写在一个.cs类里的,现在如何看这个sql是写对还是错?就是如何把正在运行的sql语句写出来?
- statusStrip1 咋控制其不闪烁
- 求:数据从一个数据库中转到另一个数据库的解决方案!表结构相同!
- c#的switch和vb的select的比较,c#难道没有好的方法吗?
- 资源问题
- 参数传递中有“%+数字”时的错误!
Good Good Study,Day Day Up。