开发者

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

开发者 https://www.devze.com 2022-12-21 22:58 出处:网络
I\'m trying to create a service reading the dead-letter from the transactional system dead letter queue.

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));
serviceHo开发者_JS百科st.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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号