2
votes

I'm attempting to use multiple EntityFramework 6 DataContexts in a TransactionScope using{}.

I get the following Exception

A first chance exception of type 'System.Data.Entity.Core.EntityException' occurred in mscorlib.dll

Additional information: The underlying provider failed on Open.

Inner Exception 1

Network access for Distributed Transaction Manager (MSDTC) has been disabled.

Please enable DTC for network access in the security configuration for MSDTC using the Component Services Administrative tool.

Inner Exception 2

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

(Exception from HRESULT: 0x8004D024)

The code works fine without the TransactionScope.

Here are the questions I need answered:

What is the best way to apply transactions to two datacontexts being used at the same time? What am I doing wrong?

1
what version of .NET?Mitch Wheat
Can you post your code?Akash Kava
Do the contexts address different databases?Gert Arnold
Different databases and also different servers.Chris

1 Answers

1
votes

It's not EF that's stopping you, but DTC. DTC is needed when using two or more simultaneous connections to MSSQL.

See http://msdn.microsoft.com/en-us/library/dd327979.aspx

ps. Duplicate of MSDTC issue with transactions in ADO.NET Entity Framework