Im running an ASP.NET MVC application hosted with Mosso, there are telling me that they cannot enable DTC because they run everything in medium trust.
So when executing code that references: TransactionScope I get the following error. The transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D024)
Is there anyway to get around this?
Are you using multiple data contexts? Using a single data context within a TransactionScope shouldn't force the transaction to be promoted to a distributed transaction. If you are using multiple data contexts, make sure that they are sharing the same connection. I would think that if they share a connection it would pick up the transaction associated with the scope and simply use it. If not, you might need to explicitly set the transaction on the context.
using (var ts = new TransactionScope())
{
using (var dcOuter = new FooDataContext())
{
using (var dcInner = new BarDataContext( foo.Connection ))
{
....
}
}
ts.Complete();
}
User contributions licensed under CC BY-SA 3.0