10

From what I'm reading, in order to use TransactionScope in .NET, you need the Distributed Transaction Coordinator service in Windows to be running. I have that service turned off, and my app seems to be running the same and rolls back transactions no problem.

Am I missing something? How is it able to work? I'm running Windows 7 and running the webapp off VisualStudio 2010.

Kiquenet
  • 14,494
  • 35
  • 148
  • 243
SaltProgrammer
  • 1,045
  • 2
  • 13
  • 29
  • 1
    DTC is required, to my knowledge, when your transaction needs to cross certain boundaries. For example, I believe you need it for a transaction across two databases on the local machine, or to escalate your transaction to a remote server. I don't have hard proof/links of it so I'll just leave this as a comment for you to investigate instead of as an answer. Hope it helps. – Smudge202 Jan 31 '12 at 07:15

2 Answers2

11

More modern versions of windows have a mini DTC version in kernel. It is not distributed but uses the same API - but it can only handle one ressource per transaction scope.

TransactionScope uses that at a start, then "promotes" the transaction to the real DTC the moment a second resource is added (resource in your case is a database connection). So, as long as your use case is ismple, you avoid the (high) overhead of the DISTRIBUTED part of DTC and can work without the service running.

More information about the Kernel Transaction Managger can be found at http://en.wikipedia.org/wiki/Kernel_Transaction_Manager

MS added it also because NTFS got transactional and it needed to make sure a DTC is aavailable.

http://www.codeguru.com/cpp/article.php/c18309/

Matthew Murdoch
  • 30,874
  • 30
  • 96
  • 127
TomTom
  • 61,059
  • 10
  • 88
  • 148
9

MSDTC comes into the play only if you have more than one transaction with different connections

SO, the answer is:

It depends!

  • If you use 1 TranScope per 1 connection - then NO
  • If you use 1 TranScope per more than 1 connection - then YES
  • If you created TransactionScope object which requires Distributed transaction - then YES
Oleg Dok
  • 21,109
  • 4
  • 45
  • 54
  • 1
    Really? If you state clearly, than in one TranScope you use more than one connection, then I update the answer, else - it looks like you use 1 connection per transaction scope - this scenario not involves MSDTC – Oleg Dok Jan 31 '12 at 08:20