Tech Dreams

How To Fix “MSDTC on server ‘server name’ is unavailable” Error[ASP.NET/SQL Server]

When I used the .NET TransactionScope object to control a transaction in a web page the following error message greeted me

————————————————————————————————————————

MSDTC on server ‘GopinathM’ is unavailable.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: MSDTC on server ‘GopinathM’ is unavailable.

————————————————————————————————————————

This error occurs when the “Distributed Transaction Coordinator” service is not running. To start a distributed transactions with TransactionScope object, the windows service “Distributed Transaction Coordinator” should be running.

To fix the problem just start the service “Distributed Transaction Coordinator” using Windows Service manager.

Here are the detailed steps for starting the service

  1. Click on Start–>Control Panel->Administrative Tools->Services (or simply type services.msc in the run command box and hit enter); display “Services” manager
  2. Scroll through the list and identify the service “Distributed Transaction Coordinator”
  3. Right on the service and choose “Start”

When SQL Server and the Application Server are on different boxes

The above said solution work well when SQL Server and the Application are on the same box. If they are deployed on different boxes then additionally you should follow these steps to correct the problem

  1. Click Start–>Control Panel –> Adminstrative Tools –> Component Services –> Computers
  2. Right click on My Computer and choose  Properties option
  3. Switch to MS DTC tab and check allow remote access

Repeat these steps on Application Server and Database server