WCF分布式开发常见错误(19):There was an error opening the queue打开消息队列出错
来源:互联网 发布:北京银行学知支行 编辑:程序博客网 时间:2024/06/05 11:47
在调试托管宿主 WCF MSMQ消息队列代码的时候出现错误:
There was an error opening the queue. Ensure that MSMQ is installed and running, the queue exists and has proper authorization to be read from. The inner exception may contain additional information.
打开队列有一个错误,确保MSMQ已经安装或者运行,队列存在和有读权限。异常内部也许包含额外的信息。
解决办法:
queBinding.ExactlyOnce = false;
queBinding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
// 添加服务终结点
host.AddServiceEndpoint(typeof(WCFService.IWCFMSMQService), queBinding, queBaseAddress);
//判断是否以及打开连接,如果尚未打开,就打开侦听端口
if (host.State !=CommunicationState.Opening)
host.Open();
注意:
1. NetMsmqBinding queBinding = new NetMsmqBinding(NetMsmqSecurityMode.None);消息无安全模式;
2. queBinding.ExactlyOnce = false;绑定消息只能读取一次的属性设置为false;
3.使用 host.AddServiceEndpoint(typeof(WCFService.IWCFMSMQService), queBinding, queBaseAddress);
添加终结点。
注意配置文件里的设置注销掉,只使用代码来设置,最后启动宿主即可。
参考文章:
http://social.msdn.microsoft.com/forums/en-US/wcf/thread/7ceeb231-2ff4-4431-9d61-dc071b916788
老外也遇到这个问题,讨论的也比较多,但是我修改了安全模式才解决掉。
【老徐的博客】
【作者】:Frank Xu Lei
【地址】:http://www.cnblogs.com/frank_xl/archive/2009/06/17/1504695.html
- WCF分布式开发常见错误(19):There was an error opening the queue打开消息队列出错
- WCF分布式开发常见错误解决(1):An error occurred while attempting to find services at...添加服务引用出错
- WCF分布式开发常见错误解决(9):无终结点监听,There was no endpoint listening at
- WCF分布式开发常见错误(10):套接字连接中断,The socket connection was aborted
- WCF分布式开发常见错误(20):TimeoutException was unhandled
- WCF分布式开发常见错误(12):The server was unable to process the request,服务无法处理请求
- WCF分布式开发常见错误解决(12):The server was unable to process the request,服务无法处理请求
- 经验:SQL Server Compact 出现的错误解决方法. There was an error parsing the query
- XmlSerialize error: There was an error generating the XML document.
- there was an error starting the gnome setting deamon
- spotlight soo5072:there was an error reading the tnsnames.ora
- There was an error copying the file into mtp:
- WCF分布式开发常见错误(22):The caller was not authenticated...如何在XP系统为WCF设置可信任的证书
- "There was an internal API error"错误解决方法
- IOS There was an internal API error 错误
- There was an internal error.
- WCF分布式开发常见错误(13):The transaction under which this method call was executing ,此方法调用的事务被异步中断
- WCF分布式开发常见错误(11):There is already a listener on IP endpoint ,IP 终结点 已经存在侦听器,
- WCF热门问题编程示例(3):WCF是否使用或者支持IOCP完成端口(整理补充)
- 经典技术文章翻译(2)Does WCF use or Supports IOCP?WCF是否支持或者使用了IOCP完成端口。
- WCF分布式开发步步为赢(13):WCF服务离线操作与消息队列MSMQ
- WCF热门问题编程示例(2)多个实例调用一个WCF服务操作,需要等待服务响应吗
- WCF热门问题编程示例(1):WCF服务如何获得客户端地址信息
- WCF分布式开发常见错误(19):There was an error opening the queue打开消息队列出错
- WCF分布式开发常见错误(18):Binding validation failed 绑定协议验证失败
- WCF分布式开发常见错误(17):无法启动MSMQ服务
- WCF分布式开发步步为赢(12):WCF事务机制(Transaction)和分布式事务编程
- WCF分布式开发常见错误(16):The Transaction has aborted,事务已经被中断
- WCF分布式开发常见错误(15):Communication with the underlying transaction manager has failed.
- WCF分布式开发常见错误(14):无效的操作异常,At least one operation on the ...
- WCF分布式开发常见错误(13):The transaction under which this method call was executing ,此方法调用的事务被异步中断
- WCF分布式开发常见错误(12):The server was unable to process the request,服务无法处理请求