none
VS, MSMQ and WCF - multiple invokes? RRS feed

  • Question

  • I am using transactional MSMQ and WCF.

    I can place and process a message on the queue just fine and WCF can bind to it and dispatch the message to my application.

    The problem is that if I for example have a breakpoint in Visual Studio in the application which gets the message from the queue - and if I pause for a few seconds or even a minute, I see the message being dispatched again causing the stack frames to jump to different positions/frame on the next time I press F10 or F11.

    how can I prevent this from happening so I can only monitor and work with just the current message and stop WCF/MSMQ from redispatching the message whilst I am trying to debug/inspect the message? There is only 1 message on the queue.

    Many thanks


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

    Wednesday, September 12, 2012 10:55 PM

Answers

  • After some Research and investigation, this actually is a WCF thing.

    Because I have my WCF service configured as Multiple (Concurrency) and because during debugging it has not really responded back to the queue/transaction, it redispatches the message causing the service to be invoked again.

    The workaround is to make the service (when debugging!) to Single along with the InstanceContextMode to single - so basically instead of MT (MultiThreading) it is just Single threaded altogether.


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

    • Marked as answer by ahmedilyas Sunday, September 16, 2012 12:25 PM
    Sunday, September 16, 2012 12:25 PM