Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>OK, a couple of things:</p> <ol> <li><p>I doubt that TransactionScope even has the notion of a (Sql)Connection. The reason is that it does work with all sorts of transactional resources, whether that is a dabatabase, a message queuing system, or whatever. You may want to refer to the <a href="http://msdn.microsoft.com/en-us/library/a90c30fy(v=VS.80).aspx" rel="nofollow noreferrer">MSDN Docs for System.Transactions</a> for more information. So, I guess your approach is doomed to fail to begin with.</p></li> <li><p>In your example you're missing the "ts.Complete()" call on, thus your (distributed) transaction will always be rolled back when the using-Scope ends. Now, this has nothing to do with the problem you're describing, but it's worth pointing out nevertheless.</p></li> <li><p>Your ambient transaction, the one resembled by the TransactionScope-instance, is propagated to a distributed transaction because you are using more than one connection inside of it. So essentially, the DTC on your system needs to talk with the DTC on the database server. For that to work both must be configured correctly.</p></li> </ol> <p>To configure the DTC run the "Component Services" Management Console by executiong <code>C:\Windows\System32\com\comexp.msc</code>. In the treeview navigate to "Component Services\Computers\My Computer". In the context menu open the "Properties". In the properites dialog select the "MSDTC" tab, on it click the "Security Configuration..." button.</p> <p>In the dialog make sure that the following options are selected:</p> <ul> <li>"Network DTC Access"</li> <li>"Allow Remote Clients"</li> <li>"Allow Inbound"</li> <li>"Allow Outbound"</li> <li>"Enable Transaction Internet Protocol (TIP) Transactions"</li> <li>"Enable XA Transactions"</li> </ul> <p>(Note: Some of these might not actually be necessary, YMMV)</p> <p>You may also want to to set to "No Authentication Required", depending on your local policies/requirements.</p> <p>You need to do this on both systems: the one your app runs on, and the one with the database.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload