2013-02-13 147 views
1

我有一個連接到服務總線的WCF服務隊列準備好接收消息。這很好,但我希望能夠將消息標記爲DeadLetter,如果我有處理消息的問題。目前如果我的代碼拋出異常,消息仍然從隊列中移除,但我希望能夠在配置中指定不從隊列中刪除,但將其標記爲DeadLetter。我做了一些搜索,我無法弄清楚如何做到這一點。我目前正在運行的服務作爲Windows服務服務總線隊列主機服務的異常處理

烏里baseAddress = ServiceBusEnvironment.CreateServiceUri( 「SB」, 「命名空間」, 「servicequeue」); _serviceHost = new ServiceHost(typeof(PaperlessImportServiceOneWay),baseAddress); _serviceHost.Open();

配置:

<services> 
     <service name="Enrollment.ServiceOneWay"> 
     <endpoint name="ServiceOneWay" 
        address="sb://namespace.servicebus.windows.net/servicequeue" 
        binding="netMessagingBinding" 
        bindingConfiguration="messagingBinding" 
        contract="IServiceOneWaySoap" 
        behaviorConfiguration="sbTokenProvider" /> 
     </service> 
</services> 
     <netMessagingBinding> 
     <binding name="messagingBinding" closeTimeout="00:03:00" openTimeout="00:03:00" 
       receiveTimeout="00:03:00" sendTimeout="00:03:00" sessionIdleTimeout="00:01:00" 
       prefetchCount="-1"> 
      <transportSettings batchFlushInterval="00:00:01" /> 
     </binding> 
     </netMessagingBinding> 

<behavior name="sbTokenProvider"> 
      <transportClientEndpointBehavior> 
      <tokenProvider> 
       <sharedSecret issuerName="owner" issuerSecret="XXXXXXXXXXXXXXXXXXXXXXXX" /> 
      </tokenProvider> 
      </transportClientEndpointBehavior> 
     </behavior> 

回答