我使用 NetMsmq 绑定创建了一个 WCF 服务,在我的计算机上创建了一个专用队列并执行了该项目。这样工作正常,我的 WCF 服务已启动并在调试环境中使用队列访问消息。现在,我想使用 Windows 服务托管该服务,为此我还创建了一个新项目和 Windows 安装程序(该服务在本地系统帐户下运行)。然后我尝试通过命令提示符使用 InstallUtil 命令安装此 Windows 服务。当安装进行时以及在服务主机打开期间,我收到一条异常消息:
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 服务设置的任何权限,如果是的话,您能建议应该在哪里添加这些权限吗?
Tom Hollander 有一个关于使用 WCF 的 MSMQ 的精彩博客系列,由三部分组成 - 非常值得一读!
- MSMQ、WCF 和 IIS:让它们发挥出色(第 1 部分) http://blogs.msdn.com/tomholl/archive/2008/07/12/msmq-wcf-and-iis-getting-them-to-play-nice-part-1.aspx
- MSMQ、WCF 和 IIS:让它们发挥出色(第 2 部分) http://blogs.msdn.com/tomholl/archive/2008/07/12/msmq-wcf-and-iis-getting-them-to-play-nice-part-2.aspx
- MSMQ、WCF 和 IIS:让它们发挥出色(第 3 部分) http://blogs.msdn.com/tomholl/archive/2008/07/12/msmq-wcf-and-iis-getting-them-to-play-nice-part-3.aspx
也许您会找到某处提到的问题的解决方案!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)