Do I need MSDTC for NServiceBus / NHibernate?

I am writing an NServiceBus solution and trying to use DBSubcriptionStorage. This uses NHibernate for data access and I get the following exception:

The partner transaction manager has disabled its support for remote/network transactions

I could enable MSDTC but my question is: where is this requirement coming from and can I remove it?

I am not familiar with NHibernate and I don't know if it requires MSDTC or if NServiceBus does. There is only one flat table in the NServiceBus subscription database and I can hardly see the use of MSDTC in this scenario.

Can I remove the MSDTC requirement? Will I have to write my own subscription persistence layer for that purpose?

Thanks

Answers


MSDTC is a great little animal, but can be quite insidious.

First off, I recommend that if you know you don't ever want to be a part of a distributed transaction, that you turn it OFF on your development servers. You don't want to automatically promote to a distributed transaction in DEV only to find out that it kills your real-world performance or doesn't work in production.

That being said, the answer is that ORMs like NHibernate do not, but it's very possible to get MSDTC involved if one of these conditions are met:

  • You're querying a view/table inside a transaction that is linked to another server.
  • You're using two SqlConnections (or whatever it is NHibernate uses) within a single TransactionScope
  • You're enlisting another transactional component (like MSMQ or the transactional file system) inside a TransactionScope.

If any of these conditions are met (surely there are some others I've forgotten about), your transaction will auto-promote to a distributed transaction, and MSDTC necessarily gets involved. That means that not only does MSDTC have to be working and configured for your box, it has to be configured for all boxes that want to participate in your transaction. In a simple SQL Serve scenario, that means your app server and your SQL Server both need to have it running and configured for distributed transactions.

I'm not familiar with NServiceBus, but I'd tend to think it would have all kinds of functionality which would transactionally place messages on, say, a queue.


Need Your Help

Gulp task failing when run from VS 2015 Task Runner explorer, but not from command prompt

javascript node.js visual-studio-2015 gulp task-runner-explorer

I have some Gulp tasks to do the typical clean, build, release actions for a website. Nothing particularly unusual in my mind. (In fact it's very similar to Aurelia TypeScript skeleton.)

Problem displaying the entire string in input box (in php)

php html

I am trying to display a element from mysql table in a input box type=text. The data is a string value. But i can see only the first word of the entire string.