Msmq和WCF服务 [英] Msmq and WCF Service

查看:157
本文介绍了Msmq和WCF服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用NetMsmq绑定创建了WCF服务,为此我在计算机上创建了一个专用队列并执行了该项目.这样就可以正常工作,并且启动了我的WCF服务,并在调试环境中使用队列访问了消息.现在,我想使用Windows服务托管该服务,并且同样,我创建了一个新项目和Windows安装程序(该服务在本地系统帐户"下运行).然后,我尝试通过命令提示符使用InstallUtil命令安装此Windows服务.在安装过程中以及在打开服务主机的过程中,出现异常消息:

I have created a WCF service using the NetMsmq binding for which i created a private queue on my machine and executed the project. This works fine as such and my WCF service is started and accesses the message using the queue in the debugging environment. Now, I wanted to host the service using the windows service and for the same I created a new project and windows installer as well (This service runs under Local System Account). Then I tried installing this windows service using the InstallUtil command through the command prompt. When installation is happening and during the service host opening, I get an exception saying:

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. 
Inner Exception System.ServiceModel.MsmqException: An error occurred while opening the queue:Access is denied. (-1072824283, 0xc00e0025). The  message cannot be sent or received from the queue. Ensure that MSMQ is installed and running. Also ensure that the queue is available to open with the required access mode and authorization.
   at System.ServiceModel.Channels.MsmqQueue.OpenQueue()
   at System.ServiceModel.Channels.MsmqQueue.GetHandle()
   at System.ServiceModel.Channels.MsmqQueue.SupportsAccessMode(String formatName, Int32 accessType, MsmqException& msmqException)

有人可以为上述问题建议可行的解决方案吗?我是否缺少为队列和Windows服务设置的任何权限,如果可以的话,您是否可以建议将这些权限添加到何处?

Could anyone suggest the possible solution for the above issue? Am I missing any permissions to be set for the queue as well as the windows service, if so could you suggest where should these permissions be added?

推荐答案

Tom Hollander撰写了一个由三部分组成的很棒的博客系列,介绍了如何使用WCF中的MSMQ-非常值得一试!

Tom Hollander had a great three-part blog series on using MSMQ from WCF - well worth checking out!

  • MSMQ, WCF and IIS: Getting them to play nice (Part 1)
  • MSMQ, WCF and IIS: Getting them to play nice (Part 2)
  • MSMQ, WCF and IIS: Getting them to play nice (Part 3)

也许您会在某处找到解决问题的方法!

Maybe you'll find the solution to your problem mentioned somewhere!

这篇关于Msmq和WCF服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆