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

时间:2010-03-03 09:00:24

标签: wcf service dead-letter msmq-wcf

我正在尝试创建一个服务,从事务系统死信队列中读取死信。

服务配置如下所示:

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

我的服务界面:

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

我的服务实施:

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

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

   #endregion
}

像这样启动主持人:

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

到目前为止,所有内容都在许多书籍和教程中都有描述,但是当我在事务死信队列中生成死信时,服务不会被调用。我的服务有什么问题?

感谢您的帮助 Enyra

1 个答案:

答案 0 :(得分:0)

我发现了这个问题,这很简单。 msmq客户端端点使用绑定配置,因此死信队列服务还需要一个绑定,将安全模式定义为none。

相关问题