问题描述
我有,我想使用MSDTC交易这样一个WinForms / WCF / SQLServer的应用程序:
I have a WinForms / WCF / SQLServer app where I am trying to use MSDTC transactions like this:
using System.Transactions;
// ...
var transOptions =
new TransactionOptions
{
IsolationLevel = IsolationLevel.ReadCommitted,
Timeout = TimeSpan.FromSeconds(120)
};
using (var scope = new TransactionScope(TransactionScopeOption.Required,
transOptions))
{
// ...
if (everything_is_ok)
scope.Complete();
}
在我的dev。框,服务器和客户端进程都在同一台机器上,它工作正常。但是,当我部署到QA ENV,其中服务器和客户端在不同的机器,每当 scope.Complete()
被调用时,客户端挂起超时周期(2分钟),然后我得到:
On my dev. box, where the server and client processes are on the same machine, it works fine. But when I deploy to the QA env, where server and client are on separate machines, whenever scope.Complete()
is called, the client hangs for the timeout period (2 minutes) and then I get:
在流过的事务不能解组。下面
异常:与基础事务管理器
没有通讯
这是什么原因?
推荐答案
我花了几个小时,今天试图在Windows 7解决这个问题。最后,它的工作,这就是我所做的:
I spent few hours today trying to resolve this problem under Windows 7. Finally it worked, here's what I did:
- 启用MSDTC,并允许呼入/呼出的交易(通过控制面板)
- 的打开端口的指南 - 只需按照指南
- 允许定义的端口(2)是在您的防火墙(如果你使用一个)打开
- 通过Windows防火墙允许MSDTC - 添加新的规则对入站连接msdtc.exe(应该是在%SYSTEMROOT%\system32)
- Enable MSDTC and allow inbound/outbound transactions (via Control Panel)
- The guide for opening ports via registry - just follow the guide
- Allow ports defined in (2) to be open in your firewall (in case you use one)
- Allow MSDTC through the windows firewall - add new rule for inbound connections to msdtc.exe (should be in %systemroot%\system32)
这是也许不是最好的解决办法,但实际上,在我的情况下工作的唯一的一个。
This is maybe not the best solution but in fact the only one that worked in my case.
编辑:之后在Windows 7 SP1与MSDTC另一个问题,我发现有一个你需要为了做两件事情,使工作。
After another issue with MSDTC under Windows 7 SP1 I found out that there are two things you need to do in order to make it work.
- 添加到hosts文件
服务器的IP和NetBIOS名称之间的映射。 - 添加(或编辑)两个键在HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\RPC:
RestrictRemoteClients的= DWORD:00000000
了EnableAuthEpResolution= DWORD: 00000000
这篇关于MSDTC:与底层事务管理器通信失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!