How to fix error “The partner transaction manager has disabled its support for remote/network transactions (HRESULT 0x8004D025)” when using NServiceBus with SQL Server
We recently upgraded our database server but in doing so, we broke all our NServiceBus-based Windows Services. Through the logs we noticed that the NServiceBus message handlers weren’t able to open database connections to our new SQL Server instance, instead throwing the following exception:
System.Transactions.TransactionException: The partner transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D025) ---> System.Runtime.InteropServices.COMException: The partner transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D025)
at System.Transactions.Oletx.ITransactionShim.Export(UInt32 whereaboutsSize, Byte[] whereabouts, Int32& cookieIndex, UInt32& cookieSize, CoTaskMemHandle& cookieBuffer)
at System.Transactions.TransactionInterop.GetExportCookie(Transaction transaction, Byte[] whereabouts)
Turns out Microsoft has an excellent step-by-step tutorial on how to fix this issue. The exception was thrown because the database server didn’t have the network DTC access enabled, but after following the steps from the guide and restarting the server, the problem went away.