MSDTC transaction manager was unable to fetch the transaction from the source in MVC 3. entity-framework msdtc sql-server


I am now utilizing the line of code from my controller in MVC 3 with Entities.

        using (var scope = new TransactionScope())
            _myRepository.DeleteFM2(id, name);

Then in my DeleteFM2 method, which also happens to be the method I wrote in the Entity class, it says:

    public void DeleteFM2(int id, string name)
        var data= _repositoryMD.Fetch().Where(mColl => mColl.Col1 == id);

        if (data!= null)
                //insert here is giving some error MSDTC error !
                // here I prepare a message using the '**data**'
                _repositoryHistory.Insert(name, message, "FM2", "Delete", dateTime);


Furthermore, I've created a separate class where I've specified the Insert function as

   public bool Insert(string realName, string logMessage, string tableName, string changeType, DateTime dateTime)
        var history = new History
            ModifiedBy = realName,
            ChangeType = changeType,
            DateModified = dateTime,
            LogMessage = logMessage,
            TableName = tableName


        return true;

After adding this line of code to the DeleteFM2 function mentioned above,

      _repositoryHistory.Insert(name, message, "FM2", "Delete", dateTime);

I am receiving this error, yet my code runs without it without any issues. I have used this line in all of my other methods, even those where Transaction Scope was used, but I still don't see what the issue is. Thank you. Thanks

On Open, the underlying provider failed.

System.Transactions.TransactionManagerCommunicationException: Communication with the underlying transaction manager has failed. ---> System.Runtime.InteropServices.COMException: The MSDTC transaction manager was unable to pull the transaction from the source transaction manager due to communication problems. Possible causes are: a firewall is present and it doesn't have an exception for the MSDTC process, the two machines cannot find each other by their NetBIOS names, or the support for network transactions is not enabled for one of the two transaction managers. (Exception from HRESULT: 0x8004D02B) at System.Transactions.Oletx.IDtcProxyShimFactory.ReceiveTransaction(UInt32 propgationTokenSize, Byte[] propgationToken, IntPtr managedIdentifier, Guid& transactionIdentifier, OletxTransactionIsolationLevel& isolationLevel, ITransactionShim& transactionShim) at System.Transactions.TransactionInterop.GetOletxTransactionFromTransmitterPropigationToken(Byte[] propagationToken) --- End of inner exception stack trace --- at System.Transactions.TransactionInterop.GetOletxTransactionFromTransmitterPropigationToken(Byte[] propagationToken) at System.Transactions.TransactionStatePSPEOperation.PSPEPromote(InternalTransaction tx) at System.Transactions.TransactionStateDelegatedBase.EnterState(InternalTransaction tx) at System.Transactions.EnlistableStates.Promote(InternalTransaction tx) at System.Transactions.Transaction.Promote() at System.Transactions.TransactionInterop.ConvertToOletxTransaction(Transaction transaction) at System.Transactions.TransactionInterop.GetExportCookie(Transaction transaction, Byte[] whereabouts) at System.Data.SqlClient.SqlInternalConnection.GetTransactionCookie(Transaction transaction, Byte[] whereAbouts) at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx) at System.Data.SqlClient.SqlInternalConnection.Enlist(Transaction tx) at System.Data.SqlClient.SqlInternalConnectionTds.Activate(Transaction transaction) at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction) at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure)

My FireWall settings

FireWall settings I use

9/25/2014 6:00:57 PM

Accepted Answer

The issue suggests that either MSDTC is not functioning on the database server that houses the database or that it is running but_repositoryHistory targets; or that a network problem is preventing the transaction from reaching that computer.

Verify MSDTC is set up and operating on the database server.

Verify whether Windows Firewall is active on the target server; if it is, look at the MSDTC firewall exclusions. This link is useful for that:

4/27/2012 7:38:58 AM

Popular Answer

Even if the configuration, firewalls, and netbios/dns were properly configured, I still had this issue. The two servers in my configuration were clones of one another, which prevented interoperability since MSDTC on each server had the same CID number.

Here are some more considerations for MSDTC troubleshooting. Zzz-13-Zzz describes my condition.

The MSDTC feature of the Windows operating system requires unique CID values to ensure that MSDTC functionality between computers works correctly. Disk duplicate images of Windows installations must have unique CID values or MSDTC functionality may be impaired. This can occur when using virtual hard disks to deploy an operating system to a virtual machine.

To determine if MSDTC CID values for computers that are running the Windows operating system are unique, check the values for the entries under the HKEY_CLASSES_ROOT\CID registry key on both computers. If these values are not unique for each computer then follow the steps in the section Consider reinstalling the Distributed Transaction Coordinator service if other troubleshooting steps are not successful to reinstall MSDTC on one of the computers, which will then generate unique MSDTC CID values for that computer and accommodate proper MSDTC operations.

Use the Powershell script below to reset the CIDs on a Windows 2012 server:

#View: CIDs (These must be different on all systems)
ls Microsoft.PowerShell.Core\Registry::HKEY_CLASSES_ROOT\CID | select Name

#reinstall MSDTC to regenerate CIDs. 
msdtc -uninstall
sleep 5
msdtc -install
sleep 5
Set-Service msdtc -startuptype "auto"
#then reboot for changes to take effect

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow