问题描述
我需要保持分布式事务在我的应用程序
I need to maintain distributed transactions in my application
假设服务1安装在Server1
Assume Service1 is installed on Server1
[ServiceContract]
IService1
{
[OperationContract]
Operation1();
}
服务2安装在服务器2
Service2 is installed on Server2
[ServiceContract]
IService2
{
[OperationContract]
Operation2();
}
和客户端设备消耗了两个服务
and the client is consuming the two services
using (TransactionScope ts = new TransactionScope())
{
Service1Proxy.Operation1();
Service2Proxy.Operation2();
}
我应该在哪里完全安装MSDTC,做到这一点需要安装在服务器1,服务器端和客户端
Where should i exactly install the MSDTC, do it required to be installed onServer1,Server2 and client
时它需要在这种情况下,任何额外的配置?
Is it requires any additional configuration in this case ?
推荐答案
您必须对您的客户端和服务器1,服务器2
You would have to enable MSDTC on your clients and server 1, server 2.
您应该允许出境的MSDTC的客户端上的安全配置。
你应该允许入站和出站的服务器。
如果你的数据库是一个单独的机器上,它应该允许入境。照片
you should allow outbound in the security configuration of MSDTC on your client.
you should allow Inbound and Outbound on your servers.
if your DB is on a seperate machine, it should allow Inbound.
这是我跑到使用MSDTC的一个问题,是别忘了ALLOW MSDTC异常防火墙的名单。
One issue that I ran to using MSDTC, is don't forget to ALLOW MSDTC in the list of exception of your FIREWALL.
看你的code段,你需要添加Transactionflow attribut对您的操作界面也。
Looking at your code snippet, you'll need to add the Transactionflow attribut on your operation interface also.
下面是WCF与交易一个很好的链接:基金会:事务传播一>
Here is a good link for WCF with transactions : Foundation: Transaction Propagation
这篇关于哪里MSDTC需要被安装在分布式事务的情况下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!