I have multiple web sites running on a server. These sites access a local database, and in the database, a call is made to a stored procedure on a linked server.
All the websites work fine, except one that is now running Entity Framework 6.1.1.
When the call is done, we get the error: The operation could not be performed because OLE DB provider "SQLNCLI10" for linked server "___" was unable to begin a distributed transaction.
The code running at that point is autogenerated using a .tt file...
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("procname", param1, param2, param3, param4);
As mentioned, this runs fine with older versions of EF. (This is not a problem with the configuration of MSDTC.)
On this page (Working with Transactions (EF6 Onwards)), it says:
Starting with EF6 Database.ExecuteSqlCommand() by default will wrap the command in a transaction if one was not already present. There are overloads of this method that allow you to override this behavior if you wish. Also in EF6 execution of stored procedures included in the model through APIs such as ObjectContext.ExecuteFunction() does the same (except that the default behavior cannot at the moment be overridden).
Am I stuck? Do I need to revert back to Entity Framework 5?