2010-03-03 26 views
0

我正在嘗試創建一個從事務系統死信隊列中讀取死信的服務。如何爲MSMQ3.0創建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

回答

0

我發現這個問題,這是相當伎倆。 msmq客戶端端點使用綁定配置,所以死信隊列服務也需要綁定,將安全模式定義爲none。