top of page

The transaction has already been implicitly or explicitly committed or aborted exception

  • Writer: Krishna Chaitanya
    Krishna Chaitanya
  • Jun 3, 2018
  • 1 min read

This generally occurs while Enlisting a SQL connection into the current transaction.

The usual stack trace will be something like this -

[TransactionException: The transaction has already been implicitly or explicitly committed or aborted.]

System.Transactions.Oletx.OletxTransactionManager.ProxyException(COMException comException) +326

System.Transactions.TransactionInterop.GetExportCookie(Transaction transaction, Byte[] whereabouts) +266

System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx) +379

System.Data.SqlClient.SqlInternalConnection.Enlist(Transaction tx) +50

System.Data.SqlClient.SqlInternalConnectionTds.Activate(Transaction transaction) +47

System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction) +28

System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +1242

System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +85

System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +89

System.Data.SqlClient.SqlConnection.Open() +159

The possible reasons for this issue might be the following:

1. This can occur if the two machines, the client and Server cannot find each other.

i.e., they might not be in the same domain.

Make sure that you can ping one machine from another machine via host names.

If you cannot ping successfully, add the hosts to %system32%/drivers/etc/hosts file, so that host names are resolved properly.

2. XA Transactions might not be enabled in Distributed Transaction Coordinator.

  • Navigate to Control Panel -> Administrative Tools -> Component Services -> Computers -> My Computer.

  • MS DTC Service should be running.

  • Right -click on My Computer and goto properties page.

  • Under MSDTC Tab goto Security Configuration.

  • Check whether Network DTC Access and XA Transactions are both enabled.

  • Under Transaction Manager Communication, select No Authentication Required Option.

  • Save the changes and restart the MSDTC Service.

3. Check whether any installed Firewall or inbuilt Windows Firewall is blocking the MSDTC communication on both the machines.

4. If you are not using SQL Connection in Distributed Transactions environment, you can set enlist option to false.

For Example, The connection string looks like this.

String connectionString = "Data Source=172.168.1.156;"

+ "User ID=username;"

+ "Password=passwd;"

+ "Initial Catalog=XATest;"

+ "enlist=false";

 
 
 

Recent Posts

See All
open a port in centos 7 firewall

Follow these commands to open any port in the firewall of CentOS 7. #> firewall-cmd --get-active-zones public interfaces: ens160 #>...

 
 
 

Comments


©2018 by fundamentals. Proudly created with Wix.com

bottom of page