entity-frameworkentity-framework-6msdtcsqlclient

Entity Framework Exception on Windows 2019 when using MSDTC


We have 2 servers. One box is a MS SQL Server 2017 (14.0.3192.2) running on Windows Server 2016. The other is a Windows Server 2019 box running a web service with EF 6.2.0. The 2019 box is new, the production web service is running on a Win 2k12 R2 server currently with no issues. When EF needs to perform multiple transactions in a call it sounds like the call is promoted to use MS Distributed Transaction Coordinator. On the new 2019 server we are seeing these requests as being aborted. The exception we are seeing thrown in code is "The operation is not valid for the current state of the enlistment". I've run through all the DTC troubleshooting, but everything seems to check out. We don't use the Windows Firewall and no firewall is between the servers. The Local DTC config matches our existing server and the dtcping.exe tool reports no issues talking between servers. If we turn off the code that is causing multiple transactions then the issue goes away so everything is pointing to an issue between EF and MSDTC.

We haven't been able to get the multiple transactions working on our development computers either (Windows 10). Is it possible something broke with EF and DTC in more recent versions of windows or are we missing something?

I asked in the EF github project and was told this may be more for the sql-client team than EF. I tagged sqlclient as well on this.


Solution

  • We attempted to pull down the Entity Framework 6.3.0 preview 9 nuget package and tested it on the new Windows 2019 servers and magically DTC works (doesn't abort) with the Scoped Transactions. Something in the 6.3.0 build of EF must fix the issue we are experiencing with our DTC transactions aborting using the EF 6.2.0 public nuget build.

    Since the 6.3.0 is still in preview we have rolled back to 6.2.0 in the meantime and turned off our scoped transactions until 6.3.0 is in full release. I'll update the github issue regarding this so the development team is aware.