c# - Why doesn't TransactionScope work with Entity Framework? -


Look at the code below if I start to refer to more than one organization, then I'll be the second set of code only < The following exception is found on / strong> If I comment on the second set then it works.

{"The underlying provider failed on the open."}

Inner: {"Communication with the built-in transaction manager has failed."}

< P> Inner: {"Error has been returned to a COM component with the HRESULT E_FAIL call."}

Note that this is a sample app and I know that it is in a row 2 does not make sense to make references. However, the production code has the reason to make many references in the same TransactionScope , and it can not be changed.

Edit

Here is a previous question to try to install MS-DTC. It starts competing on both server and client. Not sure that this is installed correctly, also note that I am trying to do this, this is one of the reasons that the current code within TransactionScope is the current code of ADO.NET and Linq 2 Sql Uses ... I also want to use the same transaction (this probably could Looks L, but I need to work it might be).

Solution

Windows Firewall was blocking connection to MS-DTC. TransactionScope ()) {(DatabaseBuildingModel = New Database Entity Model) (Select Advertiser from VAR v = (o) using

  (transaction skip ts = new system. S). first (); V. AcceptableLength = 1; O.SaveChanges (); } // -> By commenting on this section, this (DatabaseEntityModel o = New DatabaseEntityModel ()) {// Exception This next line is var v = (in the 1. Advertiser Selection s1). first (); V. AcceptableLength = 1; O.SaveChanges (); } // -> Ts.Complete (); }  

Your MS-DTC (Distributed Transaction Coordinator) is not working properly some reason. MS-DTC is used to coordinate the results of transactions in many heterogeneous resources, including many SQL connections.

For more information about what's actually happening, check out.

If you make sure that your MS-DTC is running and working properly, then you should not have any problem using 2 ADOnet connections - regardless of the connection to the organization structure Or other types.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -