title: How can I prevent 'System.Transactions.TransactionException' error when using NServiceBus
body: <p>My program makes use of NServiceBus as the service bus.
  Now, when I run a some part of my program, it fires a command to initiate a process. This process involves data look up from a database (with A lot of data) by 3 separate handlers (classes) in the program. So, in some way, they are happening in parallel. As these 3 classes receives and handles the same command, then starts work</p>
  
  <p>Searching through similar posts on stack overflow, I've come across a number of suggestions. Including 'increasing the timeout time' in both the config and machine.config. Done this to know avail.</p>
  
  <p>This <a href="https://stackoverflow.com/questions/21334060/the-operation-is-not-valid-for-the-state-of-the-transaction-when-trying-to-make">post</a>!  made me realise it could be an issue with NServiceBus and MSDTC.</p>
  
  <p>I've also attached visual studio debugger to the program process and witnessed the exception taking place at every point where I'm querying a repository class - which queries the database.</p>
  
  <pre><code>System.Transactions.TransactionException occurred
    HResult=-2146233087
    Message=The operation is not valid for the state of the transaction.
    Source=System.Transactions
    StackTrace:
         at 
  System.Transactions.TransactionState.EnlistVolatile(InternalTransaction 
  tx, IEnlistmentNotification enlistmentNotification, EnlistmentOptions 
  enlistmentOptions, Transaction atomicTransaction)
    InnerException: 
  </code></pre>
  
  <p>I'm tempted to just have a try catch everywhere. But that's me getting desperate. And, I'm ignoring a lot of data.</p>
  
  <p>Please, any ideas?
  All response will be appreciated.</p>