2

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?

Community
  • 1
  • 1
Chris
  • 2,766
  • 1
  • 29
  • 34

1 Answers1

1

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

Community
  • 1
  • 1
Will
  • 2,512
  • 14
  • 19
  • I had tried this before asking the question and did it wrong originally. I tried it again today and it solves the problem. Thank you for your answer! – Chris Dec 16 '13 at 18:28