我已经使用 NetMsmq 绑定(bind)创建了一个 WCF 服务,为此我在我的机器上创建了一个私有(private)队列并执行了该项目。这样可以正常工作,并且我的 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 的精彩博客系列,由三部分组成 - 非常值得一试!
也许您会在某处找到解决问题的方法!
关于windows-services - Msmq 和 WCF 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2154853/