Asked by:
MSDTC issue: msdtc.exe terminating unexpectedly everytime I run a simple code to try a distributed transaction

Question
-
I am trying a very simple distributed transaction on Windows 10 PC, but MSDTC.exe keeps dying every time I run the code.
I am new to MSDTC, so I've googled to how to set it up. I've configured everything for it from giving authorization to Network Service (User) to the folders that are related to MSDTC (dlls involved with it, app running the distributed transaction, etc.), and disabled firewalls. But I still get errors as shown below.
Error messages:
-0x8004D01B: ("XACT_E_TMNOTAVAILABLE", "The transaction manager is not available."),
-0x8004D01D: ("XACT_E_CONNECTION_DENIED", "A request to establish a connection with the transaction manager was denied."),
-from the Event Viewer
The XA Transaction Manager attempted to load the XA resource manager DLL.
The call to LOADLIBRARY for the XA resource manager DLL failed:
DLL=C:\Users\swx\Desktop\dll,
HR=0x8007007e, File=com\complus\dtc\dtc\xatm\src\xarmconn.cpp Line=2503.I thought maybe you can do msdtc only on Window servers, but that doesn't make sense to me b/c clients should be able to run distributed actions on their PCs as well. I'd love anyone's input and help, because this problem has been frustrating me beyond limits for over a week now. Below is a C# code I am using to test msdtc.
class Program
{
static void Main(string[] args)
{
string connstr = "this str works for non-distributed transactions";
PerformTransaction(connstr);
}
private static void PerformTransaction(string connstr)
{
bool first_tx_result = false;
bool second_tx_result = false;
try
{
using (TransactionScope ts = new TransactionScope())
{
using (OleDbConnection con = new OleDbConnection(connstr))
{
con.Open();
using (OleDbCommand cmd = con.CreateCommand())
{
cmd.CommandType = CommandType.Text;
cmd.CommandText = string.Format("INSERT INTO T84073 ( NO, NAME, SAL) VALUES (3000, 'king', 1000)");
cmd.ExecuteNonQuery();
first_tx_result = cmd.ExecuteNonQuery() == 1;
}
// throw new Exception("Transaction not working out");
using (OleDbCommand cmd = con.CreateCommand())
{
cmd.CommandType = CommandType.Text;
cmd.CommandText = string.Format("INSERT INTO T84073 ( NO, NAME, SAL) VALUES (3000, 'ksdg', 1000)");
cmd.ExecuteNonQuery();
second_tx_result = cmd.ExecuteNonQuery() == 1;
}
if (first_tx_result && second_tx_result)
{
ts.Complete();
}
}
}
}
catch
{
//rolling back is taken care of by transaction scope
}
}
}
}- Moved by Baron Bi Thursday, September 6, 2018 2:34 AM
Friday, August 3, 2018 6:54 AM
All replies
-
Hi,
thanks for posting here.
>>Error messages:
-0x8004D01B: ("XACT_E_TMNOTAVAILABLE", "The transaction manager is not available."),-0x8004D01D: ("XACT_E_CONNECTION_DENIED", "A request to establish a connection with the transaction manager was denied."),
Have you tried to disable the Firewall? Here is a blog about troubleshooting MSDTC communication failure. It generally has three typical things to verify, including:
- 1. MSDTC installation or configuration incorrectly on both sides .
- 2. Firewall settings which should not block two-directions of MSDTC/RPC communication
- 3. MSDTC fully depends on RPC communication, whether RPC dynamic port can be opened without issues
Besides, this forum is about desktop application development. For your case which is more related to MSDTC tool, I suggest you post on these forums below.
https://support.microsoft.com/en-us
https://answers.microsoft.com/en-us
Your understanding and cooperation will be grateful.
Best Regards,
Baron Bi
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.- Edited by Baron Bi Monday, August 6, 2018 6:29 AM
Monday, August 6, 2018 6:28 AM -
Hi Baron,
Thank you for your detailed answer. I will post questions on the forums you suggested as well.
But since you've already looked at this one, can I ask you one more question. I am actually testing XA in one server, with application and database in one machine. And from the guide document you shaerd with me, it seems to be for XA between two machines. Do you have any guidance/suggestions for my case, doing XA in just one machine?
Much thanks,
Sung
Tuesday, August 7, 2018 7:54 AM