// Find the Distributed Transaction Controller service
ServiceController service = new ServiceController("MSDTC");
if (service.Status != ServiceControllerStatus.Running)
{
try
{
service.Start();
// Wait for up to 10 seconds for the service to start
TimeSpan timeSpan = TimeSpan.FromSeconds(10);
service.WaitForStatus(ServiceControllerStatus.Running, timeSpan);
}
catch (TimeoutException exc)
{
MessageBox.Show(exc.Message);
}
}