📜 ⬆️ ⬇️

TransactionScope for client and server on different computers

Not so long ago, I had to separate the web application server and the SQL server (a separate machine was started, to which the SQL server was transferred), but it was not possible to start everything right away.
To group the teams in a transaction, the code uses TransactionScope . However, when the client application (in my case ASP.NET) and MS SQL server are on different computers, using TransactionScope results in the following error.

For transactions / remote transactions / network transactions.

Locally all set up. But since the procedure will have to be repeated when deploying on a live server, as well as when moving, I decided to write a small instruction for myself. When finished, I thought that maybe someone else would come in handy.

')
Immediately I will say the following bunch works for me
Vista Client PC
Windows Server 2008 + SQL Server 2008 - server.
If you have other combinations, then some screens on your screenshots will look different.

So, in order for everything to work, you need to configure the Distributed Transaction Coordinator on the computer with MS SQL Server and on the client computer.

Server Tuning

1. Ensure that the Distributed Transaction Coordinator service is running.
Adminstrative Tools -> Services

2. Configure Distributed Transaction Coordinator (DTC)
For this

DTC settings
After that, the service will restart.

3. You must add an exception to the Windows Firewall for Distributed Transaction Coordinator
Firewall Exception

4. After that, restart the SQL Server service.
In any case, it is better to reboot the server altogether, although I had to restart SQL Server.

Client setup

1. It is also necessary to make sure that the DTC service is running.
2. Execute 'dcomcnfg', go to the same properties as on the server and set the checkboxes

DTC settings on the client

3. Add Exceptions to Windows Firewall
Firewall nastroyki on the client

After these steps, everything worked.
More details about the appointment of all options can be read here .

Thanks for attention.

Source: https://habr.com/ru/post/94702/


All Articles