windows-services - Msmq 和 WCF 服务

标签 windows-services msmq wcf

我已经使用 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 的精彩博客系列,由三部分组成 - 非常值得一试!

  • 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)

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

    关于windows-services - Msmq 和 WCF 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2154853/

    相关文章:

    c# - 程序在访问消息队列时挂起

    sql - MSMQ v 数据库表

    c# - MassTransit - 向客户端更新消息

    c# - 如何通过 MSMQ(使用 WCF)发送 XDocument?

    c# - DebugDiag 消息线程似乎没有等待远程服务器响应

    c# - ASP.Net Architecture 解决方案/建议

    windows-services - 使用 pscp.exe 时跳过主机检查

    c# - 如何通过 C# 暂停和继续 Windows 服务

    c# - 如何获取 WCF Web 服务请求的 XML SOAP 请求?

    c# - 设置 HttpContext.Current.User 抛出空引用异常