WCF Distributed development Common error (D): There was a error opening the queue open message Queue error
An error occurred while debugging the managed hosting WCF MSMQ Message Queuing code:
There was a error opening the queue. Ensure that MSMQ are installed and running, the queue exists and has proper to being read from. The inner exception may contain additional information.
There is an error opening the queue to ensure that MSMQ is installed or running, that the queue exists and has read permissions. An exception may contain additional information inside.
Solution:
NetMsmqBinding queBinding = new NetMsmqBinding(NetMsmqSecurityMode.None);
queBinding.ExactlyOnce = false;
queBinding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
// 添加服务终结点
host.AddServiceEndpoint(typeof(WCFService.IWCFMSMQService), queBinding, queBaseAddress);
//判断是否以及打开连接,如果尚未打开,就打开侦听端口
if (host.State !=CommunicationState.Opening)
host.Open();
Attention:
1. NetMsmqBinding quebinding = new NetMsmqBinding (netmsmqsecuritymode.none), message no Safe mode;
2. Quebinding.exactlyonce = false; The property with the binding message read only once is set to false;
3. Use host. AddServiceEndpoint (typeof (Wcfservice.iwcfmsmqservice), quebinding, quebaseaddress);
Add Endpoints.
Note that the settings in the configuration file are logged off, only using code to set, and finally starting the host.
Reference articles:
http://social.msdn.microsoft.com/forums/en-US/wcf/thread/7ceeb231-2ff4-4431-9d61-dc071b916788
The foreigner also encounters this problem, the discussion is also more, but I changed the safe mode to solve out.