MSDTC - Communication with the underlying transaction manager has failed

StackOverflow https://stackoverflow.com/questions/11356077

  •  19-06-2021
  •  | 
  •  

سؤال

I am getting error:

communication with the underlying transaction manager has failed

when I am trying to run my application from visual studio 2010. I have search on google for this problem, I have tried all possible solutions to resolve this error.

Here i have made change in my DTC properties.

-- Network DTC Access
-- Allow Inbound
-- Allow Outbound
-- Allow Remote Administrator
-- Allow Remote Clients
-- No Authentication Required
-- Enable XA Transaction
-- Enable SNA LU 6.2 Transaction

Please let me know, if anyone knows the solution for this problem.

Thanks Manoj Sitapara

هل كانت مفيدة؟

المحلول

Try allowing DTC to communicate through Firewall.

enter image description here

نصائح أخرى

Download DTCPing on all computers involved in the distributed transaction and run it.

Most of the times it will give you the exact error and what's wrong (like identical CID's), etc.

Possible reasons:

  1. Computers are not reachable by NetBIOS name. In this case you either have to adjust their hosts file to add mappings IP/hostname or, if in a domain, add DNS aliases for them.
  2. The servers are VMs and they were cloned from the same VM instance. In this case the MSDTC CIDs are identical and you need to install/reinstall MSDTC (DTCping will tell you this).

Check the MSDTC troubleshooting guide, which lists duplicate CIDs as a potential issue. You can use the following Powershell script to detect duplicate CIDs and reinstall MSDTC if needed using WinRM:

write-host "Checking for duplicate CIDs and reinstalling MSDTC if needed."
$servers = "server1","server2","server3"
$CIDs = Invoke-Command -ComputerName $servers -ScriptBlock { gci Microsoft.PowerShell.Core\Registry::HKEY_CLASSES_ROOT\CID | foreach { $_.Name } | Out-String -Stream } #Array of all CIDs on all servers
$UniqueCIDs = $CIDs | select -Unique
if($CIDs.Length -eq $UniqueCIDs.Length){
    Write-Output "All CIDs are unique, so we don't need to reinstall MSDTC"
} else {
    Write-Output "Found duplicate CIDs, so we need to reinstall MSDTC on all VMs"
    Invoke-Command -ComputerName $servers -ScriptBlock {
        write-output "`r`nUninstalling MSDTC to regenerate CIDs on $env:computername" 
        msdtc -uninstall | Write-Output
        sleep 25 #wait for previous command to finish
        write-output "`r`nReinstalling MSDTC to regenerate CIDs on $env:computername" 
        msdtc -install  | Write-Output
        sleep 25 #wait for previous command to finish
        write-output "`r`nSetting MSDTC service to automatic on $env:computername" 
        Set-Service msdtc -startuptype "auto"
        write-output "`r`nWARNING: $env:computername may need to be restarted for changes to take effect." 
    }
}

I got the failed communication error while trying to set up DTC and MSMQ on a cluster. In my case the underlying error was "Ran out of memory." I was able to send transactional messages from the cluster to another server, but not back from that server to the cluster. My service would throw this exception:

System.Transactions.TransactionAbortedException: The transaction has aborted. 
---> System.Transactions.TransactionManagerCommunicationException: Communication 
with the underlying transaction manager has failed. ---> 
System.Runtime.InteropServices.COMException: Ran out of memory (Exception from HRESULT: 0x80000002)

This article had the very obscure solution: http://www.nervousadmin.com/category/microsoft/windows/dtc/

To summarize:

There is a guid in the registry for the key ClusterDefaultResource under HKLM\Cluster\ResourceTypes\Distributed Transaction Coordinator that needs to align with the guid argument on the DTC service's path to executable.

Another symptom of this issue is that you would get an out of memory error if you try to access the DTC properties via the Component Services management console. Look in the console tree under Component Services/Computers/My Computer/Distributed Transaction Coordinator and right click on each of the DTCs listed there. This will throw the error if your guids are not aligned.

  • Open services.msc. Find the Distributed Transaction Coordinator (if there are two, you're looking for the one with the guid in its name)
  • Open that DTC's properties. Copy the guid from the 'path to executable'
  • Open regedit. Find HKLM\Cluster\ResourceTypes\Distributed Transaction Coordinator
  • Compare the ClusterDefaultResource value to the guid you've copied. If they are different, the next step should fix things. If not, this isn't your answer.
  • Back up the current value. Edit the ClusterDefaultResource property: paste the guid you copied from the services.msc DTC properties. You will need to do this on each node in your cluster.
  • With luck, this has solved your problem.
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top