简体   繁体   English

如何为MSMQ3.0创建WCF死信服务

[英]How to create a WCF dead-letter service for MSMQ3.0

I'm trying to create a service reading the dead-letter from the transactional system dead letter queue. 我正在尝试创建一个从事务系统死信队列中读取死信的服务。

The service configuration looks like this: 服务配置如下所示:

<service name="NotificationDeadLetterQueueService">
 <endpoint
  address="net.msmq://localhost/system$;DeadXact"
  binding="netMsmqBinding"
  contract="INotificationService"
/>
</service>

My service interface: 我的服务界面:

[ServiceContract]
public interface INotificationService
{
[OperationContract(IsOneWay=true)]
[NetDataContractSerializerFormatAttribute]
void HandleNotification(Notification notification);
}

With my service implementation: 通过我的服务实施:

[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
public class NotificationDeadLetterQueueService : INotificationService
{
   #region INotificationService Members

   [OperationBehavior(TransactionScopeRequired = true)]
   public void HandleNotification(Notification notification)
   {
      throw new NotImplementedException();
   }

   #endregion
}

And start the host like this: 像这样启动主机:

ServiceHost serviceHost = new ServiceHost(typeof(NotificationDeadLetterQueueService));
serviceHost.Open();

So far everything looks like described in many books and tutorials, but when I generate dead-letters within the transactional dead-letter queue the service does not get invoked. 到目前为止,一切看上去都像许多书籍和教程中所描述的,但是当我在事务性死信队列中生成死信时,该服务不会被调用。 What is wrong in my service? 我的服务有什么问题?

Thanks for help Enyra 感谢您的帮助Enyra

I found the problem, which is quite trick. 我发现了问题,这很棘手。 The msmq client endpoint uses a binding configuration with , so the dead-letter queue service also needs a binding which defines the security mode to none. msmq客户端终结点使用带有的绑定配置,因此,死信队列服务还需要将安全模式定义为none的绑定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM