无法从(死信)队列中提取服务 [英] Can't get service to pull from (dead letter) queue

查看:134
本文介绍了无法从(死信)队列中提取服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在远程计算机上有一个名为log的队列.当我在本地调用该队列时,我通过修改NetMsmqBinding指定了一个自定义死信队列:

I have a queue named log on a remote machine. When I call that queue locally, I specify a custom dead-letter queue by modifying my NetMsmqBinding:

_binding.DeadLetterQueue = DeadLetterQueue.Custom;
_binding.CustomDeadLetterQueue = new Uri(
    "net.msmq://localhost/private/Services/Logging/LogDeadLetterService.svc");

这很好用;当我强制邮件无法到达其目的地时,它将显示在此队列中.

This works fine; when I force my message to fail to get to its destination, it appears in this queue.

现在,我在IIS/WAS中托管了一个服务来读取死信队列.它托管在一个名为Services的站点中,位于Services/Logging/LogDeadLetterService.svc.这是我的配置中的服务:

Now, I have a service hosted in IIS/WAS to read the dead-letter queue. It it hosted in a site called Services, at Services/Logging/LogDeadLetterService.svc. Here's the service in my config:

  <service name="Me.Logging.Service.LoggingDeadLetterService">
    <endpoint binding="netMsmqBinding"
              bindingNamespace="http://me.logging/services/2012/11"
              contract="Me.Logging.Service.Shared.Service.Contracts.ILog" />
  </service>

这是我的激活:

    <add relativeAddress="LogDeadLetterService.svc"
         service="Me.Logging.Service.LoggingDeadLetterService" />

我的实际服务基本上是这样:

My actual service is basically this:

[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any, // Pick up any messages, regardless of To address.
                 InstanceContextMode = InstanceContextMode.Single, // Singleton instance of this class.
                 ConcurrencyMode = ConcurrencyMode.Multiple, // Multiple callers at a time.
                 Namespace = "http://me.logging/services/2012/11")]
public class LoggingDeadLetterService : ILog
{
    public void LogApplication(ApplicationLog entry)
    {
        LogToEventLog(entry);
    }
}

我的队列是事务性的,并且已通过身份验证.我在服务站点和日志记录"应用程序中都将net.msmq作为启用协议包括在内,并且我向服务站点添加了net.msmq绑定.如果我的绑定信息为appdev.me.com,则浏览到 http://时,会出现以下错误appdev.me.com/Logging/LogDeadLetterService.svc (在我的HOSTS文件中设置了appdev.me.com):

My queue is transactional and authenticated. I have net.msmq included as enabled protocols both on the Services site and on the Logging application, and I added a net.msmq binding to the Services site. If I have the binding information as appdev.me.com, I get the following error when browsing to http://appdev.me.com/Logging/LogDeadLetterService.svc (appdev.me.com is setup in my HOSTS file):

An error occurred while opening the queue:Access is denied. (-1072824283, 0xc00e0025).

如果绑定信息为localhost,则会出现以下错误:

If I have the binding information as localhost, I get the following error:

An error occurred while opening the queue:The queue does not exist or you do not have sufficient permissions to perform the operation. (-1072824317, 0xc00e0003).

无论我以哪种方式进行设置,该服务都不会拾取死信,因为它仍然在队列中,而不在我的事件日志中.

No matter which way I have it set up, the service isn't picking up the dead letter, as it's still in the queue and not in my event log.

现在,我意识到这两个都引用了权限问题.但是,为了弄清楚认证部分之前对它的代码部分进行测试,我将完全控制权授予了我可能想到的每个人-包括所有人,经过身份验证的用户,网络服务,IIS_USERS,匿名登录和我自己. (应用程序池正在像我一样运行.)

Now, I realize that both of these reference a permissions issue. However, in the interest of getting the code part of this tested before figuring out the authentication piece, I have given Full Control to everyone I could think of - to include Everyone, Authenticated Users, NETWORK SERVICE, IIS_USERS, ANONYMOUS LOGON, and myself. (The app pool is running as me.)

任何有关如何使我的服务能够从此队列中拉出的帮助都将是惊人的.谢谢!

Any help as to how to get my service to be able to pull from this queue would be phenomenal. Thanks!

编辑:根据此MSDN博客条目,0xC00E0003对应于MQ_ERROR_QUEUE_NOT_FOUND,而0xc00e0025对应于MQ_ERROR_ACCESS_DENIED,因此看起来我想将绑定信息设为appdev.me.com.但是,这仍然不能解决明显的权限问题.

According to this MSDN blog entry, 0xC00E0003 corresponds to MQ_ERROR_QUEUE_NOT_FOUND, and 0xc00e0025 corresponds to MQ_ERROR_ACCESS_DENIED, so it looks like I want to have the binding information as appdev.me.com. However, that still doesn't resolve the apparent permissions issue occurring.

EDIT2 :如果我在控制台应用程序中托管该服务并提供以下端点,则它可以工作:

It works if I host the service in a console app and provide the following endpoint:

    <endpoint address="net.msmq://localhost/private/Services/Logging/LogDeadLetterService.svc"
              binding="netMsmqBinding"
              bindingNamespace="http://me.logging/services/2012/11"
              contract="Me.Logging.Service.Shared.Service.Contracts.ILog" />

那么,控制台应用程序中发生的事情与IIS中发生的事情有何不同?由于上面的 EDIT ,我非常有信心自己能赶上队列.那我为什么不能进入呢?

So what's going on differently in the console app than is going on in IIS? I'm pretty confident, due to EDIT above, that I'm hitting the queue. So why can't I get into it?

根据//

[奖励问题:我需要处理我的死信队列中的有毒消息吗?]

[Bonus question: Do I need to handle poison messages in my dead letter queue?]

推荐答案

因此,需要更改三件事:

So, three things needed to be changed:

  1. 绑定确实必须为localhost.
  2. 必须将队列命名为Logging/LogDeadLetterService.svc-它是应用程序和服务,而不是站点,应用程序和服务.
  3. 我把应用程序池弄得一团糟-我不知道它是什么,但是使用另一个应用程序池是可行的,所以我撤消了所有与服务相关的更改,然后重新创建了所有内容,然后它就起作用了. /li>
  1. The binding does have to be localhost.
  2. The queue has to be named Logging/LogDeadLetterService.svc to be found - it's the application and the service, not the site, application, and service.
  3. I had something messed up with the application pool - I have no idea what it was, but using a different app pool worked, so I backed out all of my service-related changes and then recreated everything, and it works.

好吧,这很容易使我的头撞到我的桌子上,就像不要弄乱你的应用程序池"之类的简单事情.

Well, that was a lot of banging my head against my desk for something as simple as "don't mess up your app pool."

这篇关于无法从(死信)队列中提取服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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