none
WCF and transactional MSMQ - multiple dispatches? RRS feed

  • Question

  • using Transactional MSMQ and WCF here in C#

    sometimes for some reason, the message gets redispatched from the MSMQ even though the previous time, the message was processed successfully (i.e no unhandled exceptions or anything). There is only just the 1 msg I am placing on the queue.

    any ideas why?

    Sure, I am also debugging when the msg gets dispatched but I only have a very small number of breakpoints in certain areas and spend no longer than 3 seconds looking at the things I need to look at in that context of the msg being flowed into the system.

    any ideas why duplicate dispatches?


    [ServiceContract]
    [ServiceKnownType(typeof(CustomMessage))]
    [ServiceKnownType(typeof(MessageA))]
    [ServiceKnownType(typeof(MessageB))]
    public interface IMessageHandlerService
        {
            [OperationContract(IsOneWay = true, Action = "*")]
            void ProcessMessage(MsmqMessage<CustomMessage> message);
        }
    [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single, InstanceContextMode = InstanceContextMode.Single, ReleaseServiceInstanceOnTransactionComplete = false)]
        public sealed class MessageHandlerService : IMessageHandlerService
        {
            [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
            public void ProcessMessage(MsmqMessage<CustomMessage> message)
            {
                ...
            }
        }

    my ABC:
    <system.serviceModel>
        <behaviors>
          <endpointBehaviors>
            <behavior name="IncludeExceptionDetails">
              <callbackDebug includeExceptionDetailInFaults="true" />         
            </behavior>
          </endpointBehaviors>
        </behaviors>
        <services>
          <service name="Services.Implementation.MessageHandler.MessageHandlerService">
            <endpoint address="msmq.formatname:DIRECT=OS:.\private$\msgs" binding="msmqIntegrationBinding" bindingConfiguration="MessageHandlerBinding" contract="Services.Contracts.Messages.IMessageHandlerService">
            </endpoint>
          </service>
        </services>
        <bindings>
          <msmqIntegrationBinding>
            <binding name="MessageHandlerBinding"
                     closeTimeout="00:30:00"
                     receiveTimeout="01:00:00"
                     retryCycleDelay="00:00:10"
                     receiveRetryCount="0"
                     exactlyOnce="true"
                     maxRetryCycles="1"
                     receiveErrorHandling="Move">
              <security mode="None"/>
            </binding>
          </msmqIntegrationBinding>
        </bindings>
      </system.serviceModel>

    as you can see, I do have ExactlyOnce = true.

    This problem only happens sometimes, not all the time. im stumped!


    C# MVP (2007-2010) MS Vendor - MS All the way! Follower since 1995 MS Super Evangelist| MSDN Forums Moderator

    Thursday, November 1, 2012 1:36 PM
    Moderator

All replies