As mentioned in a previous post, we were encountering issues when using the Distributed Transaction Coordinator.
By using the DTCTester tool we were able to prove that the problem was indeed related to the DTC settings and not a bug in our code(as if that could happen ).
Executed: dtctester
DSN: test
User Name: username
Password: password
tablename= #dtc26446
Creating Temp Table for Testing: #dtc26446
Warning: No Columns in Result Set From Executing: 'create table #dtc26446 (ival int)'
Initializing DTC
DtcGetTransactionManager failed: 8004d01b
DtcGetTransactionManager Call Error: Indicates unable to connect to the transaction manager, or the transaction manager is unavailable.
We were able to solve the issue by adding an exception for msdtc.exe in our firewall:
- Click on the Windows icon and start typing ‘firewall’. Choose ‘Allow an app through Windows Firewall’.
- The Allowed Apps window is loaded. Click on Change Settings. The Allow another app… button becomes enabled.
- Click on the Allow another app… button and choose Browse… to select an application.
- Search for MSDTC.exe and click on Open.
- Click on Add to close the wizard.
- Let’s try the DTCTester again to see if it works now:
Executed: dtctester
DSN: test
User Name: username
Password: password
tablename= #dtc27076
Creating Temp Table for Testing: #dtc27076
Warning: No Columns in Result Set From Executing: 'create table #dtc27076 (ival int)'
Initializing DTC
Beginning DTC Transaction
Enlisting Connection in Transaction
Executing SQL Statement in DTC Transaction
Inserting into Temp...insert into #dtc27076 values (1)
Warning: No Columns in Result Set From Executing: 'insert into #dtc27076 values (1) '
Verifying Insert into Temp...select * from #dtc27076 (should be 1): 1
Press enter to commit transaction.Commiting DTC Transaction
Releasing DTC Interface Pointers
Successfully Released pTransaction Pointer.
Disconnecting from Database and Cleaning up Handles
- Fixed!