0

I've been doing a lot of reading on this one, and some of the documentation doesn't seem to relate to reality. Some of the potential causes would be appropriate here, however they're only related to 2008 or earlier.

I define a transaction scope. I use a number of different EF contexts (in different method calls) within the transaction scope, however all but one of them are only for data reads. The final use of a Context is to create and add some new objects to the context, and then call

context.SaveChanges()

IIS is running on one server. The DB (Sql2012) is running on another server (WinServer 2012).

When I execute this code, I receive the error:

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.

Obviously, if I enable DTC on the IIS machine, this goes away. However why should I need to?

This:

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

states:

• At least one durable resource that does not support single-phase notifications is enlisted in the transaction. • At least two durable resources that support single-phase notifications are enlisted in the transaction

Which I understand is not the case here.

hitch
  • 899
  • 1
  • 11
  • 26

1 Answers1

0

Ok. I'm not entirely sure if this should have been happening (according to the MS doco), but I have figured out why and the solution.

I'm using the ASPNet membership provider, and have two connection strings in my web.config. I thought the fact that they were pointing to the same DB was enough for them to be considered the same "durable resource".

However I found that the membership connection string also had:

Connection Timeout=60;App=EntityFramework

whereas the Entity Framework connection string didn't.

Setting these values to the same connection string meant that the transaction is not escalated to MSDTC.

hitch
  • 899
  • 1
  • 11
  • 26