【问题标题】:Msmq and WCF ServiceMsmq 和 WCF 服务
【发布时间】:2011-01-10 10:09:18
【问题描述】:

我使用 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 服务设置的任何权限,如果是这样,您能否建议在哪里添加这些权限?

【问题讨论】:

    标签: windows-services msmq wcf


    【解决方案1】:

    是的,看起来像是权限问题。

    在服务器管理器中右键单击您的私人队列,然后选择属性。进入“安全”选项卡,并确保您在其中拥有本地系统帐户的正确权限。

    这在 Nicholas Allen 的文章中也得到了证实:Diagnosing Common Queue Errors,其中作者将错误代码 0xC00E0025 定义为权限问题。

    【讨论】:

    • 感谢丹尼尔的回复。如果这就是所谓的本地系统帐户,我已经尝试为列表中存在的机器帐户提供所有相关权限。但是我得到了同样的错误。已创建的私有队列以我的域登录作为其所有者。我不知道我需要设置哪些所有权限。您能否建议是否缺少任何其他可能的权限?
    • Sowmya,你搞定了吗?如果没有,请检查此链接beyondrelational.com/blogs/ibhadelia/archive/2011/06/21/…
    【解决方案2】:

    Tom Hollander 有一个很棒的博客系列,由三部分组成,关于使用 WCF 中的 MSMQ - 非常值得一试!

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

    【讨论】:

      【解决方案3】:

      我遇到了同样的问题,这里是解决方案。

      右键单击“我的电脑”--> 管理。在计算机管理窗口中,转到“服务和应用程序--> 消息队列--> 您的队列”,选择您的队列并访问属性。添加运行您的 WCF 应用程序的用户并授予完全访问权限。这应该可以解决问题。

      【讨论】:

        【解决方案4】:

        可能很简单,服务找不到它的队列。 队列名称必须与端点地址完全匹配。

        例子:

        net.msmq://localhost/private/wf.listener_srv/service.svc

        指向本地队列

        private$\wf.listener_srv\service.svc

        如果队列名称和端点相互一致,则最类似于IIS pool 上定义的凭据不授予对队列的访问权限。

        【讨论】:

          猜你喜欢
          • 2012-03-16
          • 1970-01-01
          • 1970-01-01
          • 2015-08-20
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2010-11-28
          • 2012-01-05
          相关资源
          最近更新 更多