views:

519

answers:

5

I am using Two SQL Server connection object in my C# console application project. I need to do this in single transaction So I used Transactionscope (Distributed Transaction)

I am not able to use the connection within the transactionscope It is displaying the error

MSDTC on server is unavailable.

How can I solve.... Both the one sql connection is remote server and another one is local server.

Note:- The msdtc service is already started.

The server started on both the machines. Still I am facing the issue. Do I need to turn off the firewall in my local intranet machines.

+1  A: 

Start MSDTC Service.

On the command prompt:

net start msdtc

Or from Services MMC. Find "Distributed Transaction Coordinator" and click start.

Mike Chaliy
+2  A: 

If you are having difficulty getting DTC to play nicely (especially when either a firewall or a SQL cluster are involved) then DTCPing is a great tool (by Microsoft) to identify it. Note that (IIRC) you need to be able to DTCPing in both directions

Marc Gravell
+2  A: 

Whenever you do a distributed transaction, the Microsoft Distributed Transaction Coordinator needs to be running on your local machine and on all servers which participate in the transaction. If you have firewalls in place you will also need to make sure that you have limited the ports on which MSDTC communicates and added the appropriate rules to your firewall configuration to allow the connections -- I believe it needs portmapper access as well as the specific port range you've chosen for RPC. There are also various security settings for MSDTC that need to be synchronized that control how authentication is done between the servers.

Here are some links that may be helpful:

  1. MSDTC at MSDN
  2. MSDTC Troubleshooting
  3. MSDTC and Firewall Issues
tvanfosson
+1  A: 

I had the same problem on a project I worked on recently. Unfortunately I did not have the rights to be able to start MSDTC as described in a different answer. If you are in the same situation I would suggest reading the question I posted a while back about this issue.

MSDTC Issue

Joseph
A: 

Just an idea, you've probably tried this already. If you have confirmed that the MSDTC service is running, have you had a look at the event logs on the machines which are running the services? You may find error information from the services there.

Niall Connaughton