微软消息队列路径的使用问题
2015-05-11 17:10
274 查看
今天在测试微软消息队列,打算把消息发到服务器的,用IP地址来指定。
开发时用本地环回IP127.0.0.1来测试,方便提交后其他同事使用,结果发现坑爹的事情了
System.Messaging.MessageQueue queue = new System.Messaging.MessageQueue("FormatName:DIRECT=TCP:127.0.0.1\\private$\\test");
发送的消息,堆在“传出队列”里面,状态是等待连接
读取时也发生异常System.Messaging.MessageQueueException
HResult=-2147467259
Message=队列不存在,或您没有足够的权限执行该操作。
反复测试后发现,用127.0.0.1是不行的,换成一个本机IP就可以了
System.Messaging.MessageQueue queue = new System.Messaging.MessageQueue("FormatName:DIRECT=TCP:192.168.2.88\\private$\\test");
以上信息希望可以为大家提供帮助,少走弯路。
现象发送接收代码如下:
发送
System.Messaging.MessageQueue queue = new System.Messaging.MessageQueue(ARPAUploadMessageQueueName);
var msg = new System.Messaging.Message();
msg.Body = new myData();
msg.Formatter = new System.Messaging.XmlMessageFormatter(new Type[] {msg.Body.GetType() });
msg.Recoverable = true;
接收
System.Messaging.MessageQueue queue = new System.Messaging.MessageQueue("FormatName:DIRECT=TCP:192.1.0.127\\private$\\arpatest");
var msg = queue.Receive();
msg.Formatter = new XmlMessageFormatter();
Console.WriteLine("读取队列对象."+msg.Body);
开发时用本地环回IP127.0.0.1来测试,方便提交后其他同事使用,结果发现坑爹的事情了
System.Messaging.MessageQueue queue = new System.Messaging.MessageQueue("FormatName:DIRECT=TCP:127.0.0.1\\private$\\test");
发送的消息,堆在“传出队列”里面,状态是等待连接
读取时也发生异常System.Messaging.MessageQueueException
HResult=-2147467259
Message=队列不存在,或您没有足够的权限执行该操作。
反复测试后发现,用127.0.0.1是不行的,换成一个本机IP就可以了
System.Messaging.MessageQueue queue = new System.Messaging.MessageQueue("FormatName:DIRECT=TCP:192.168.2.88\\private$\\test");
以上信息希望可以为大家提供帮助,少走弯路。
现象发送接收代码如下:
发送
System.Messaging.MessageQueue queue = new System.Messaging.MessageQueue(ARPAUploadMessageQueueName);
var msg = new System.Messaging.Message();
msg.Body = new myData();
msg.Formatter = new System.Messaging.XmlMessageFormatter(new Type[] {msg.Body.GetType() });
msg.Recoverable = true;
接收
System.Messaging.MessageQueue queue = new System.Messaging.MessageQueue("FormatName:DIRECT=TCP:192.1.0.127\\private$\\arpatest");
var msg = queue.Receive();
msg.Formatter = new XmlMessageFormatter();
Console.WriteLine("读取队列对象."+msg.Body);
相关文章推荐
- [导入]使用微软消息队列构建可靠的移动应用程序
- 使用微软消息队列实现C#进程间通信
- 使用微软消息队列实现C#进程间通信
- 使用微软消息队列实现C#进程间通信
- 使用微软消息队列实现C#进程间通信
- 使用微软消息队列实现C#进程间通信
- [转]使用微软消息队列实现C#进程间通信
- 使用微软消息队列实现C#进程间通信(转)
- 微软MSMQ消息队列的实际使用记录
- C#_使用微软消息队列实现C#进程间通信
- [MQ]微软消息队列(MSMQ)配置使用小结(c#)
- 使用微软消息队列实现C#进程间通信
- 使用微软消息队列实现C#进程间通信
- MSMQ(微软消息队列)简单使用-支持离线提交数据(供阅)
- 使用微软消息队列实现C#进程间通信(一)
- 使用微软消息队列实现C#进程间通信(二)
- 使用微软消息队列实现C#进程间通信(三)
- IPC之 - 使用微软消息队列实现C#进程间通信
- 关于微软消息队列MSMQ长时间没消息,监听失效的问题
- 使用MSMQ消息队列的WCF的效率的问题。