Windows 7 - 启用网络 DTC 访问
我有一个 Visual Studio 2010 Windows 窗体应用程序,在其中使用 TransactionScope 类启动事务。然后,我从 Sql Server Broker Services 消息队列接收消息,效果很好。接下来,我尝试从同一数据库调用存储过程,并调用我的数据访问层,即 Visual Studio 数据集(xsd 文件)。当我对数据库进行第二次调用时,我收到以下错误消息:
由于通信问题,MSDTC 事务管理器无法从源事务管理器中提取事务。可能的原因有:存在防火墙且 MSDTC 进程没有例外、两台计算机无法通过 NetBIOS 名称找到对方,或者两台事务管理器之一未启用对网络事务的支持。 (HRESULT 异常:0x8004D02B)。
我在网上看到过几篇文章,讨论通过 dcomcnfg.exe 启用 DTC 访问,以及允许 DTC 通过 Windows 防火墙进行通信。我已经做了这些事情,但仍然遇到这个问题。我知道我们的远程数据库服务器设置为启用 DTC 访问,因为我们在 Windows XP 和 Vista 上使用 Visual Studio 2008 构建的其他项目中使用类似的事务。我认为 Windows 7 和 Visual Studio 2010 有一些特定的原因导致了这个问题,但一直无法找出它是什么。任何人都可以帮助解决这个问题吗?
我刚刚在网上看到另一位程序员有这个问题的帖子(http:// /www.pcreview.co.uk/forums/thread-3977150.php),他说它在 Windows 7 - x86 上运行良好,但在 Windows 7 - x64 上出现此错误。我运行的是 x64 版本的 Windows 7,有谁知道 Windows 7 - 64 位版本上的 MSDTC 是否存在问题?
I have a Visual Studio 2010 Windows Forms application in which I start a transaction using the TransactionScope class. I then Receive a message from a Sql Server Broker Services message queue, which works fine. I next try to call a stored procedure from the same database with a call to my data access layer which is a Visual Studio dataset (xsd file). When I make this second call to the database I get the following error message:
The MSDTC transaction manager was unable to pull the transaction from the source transaction manager due to communication problems. Possible causes are: a firewall is present and it doesn't have an exception for the MSDTC process, the two machines cannot find each other by their NetBIOS names, or the support for network transactions is not enabled for one of the two transaction managers. (Exception from HRESULT: 0x8004D02B).
I've seen several posts on the web that talk about Enabling DTC access through dcomcnfg.exe, and allowing DTC to communicate through Windows Firewall. I've done those things, and am still having this problem. I know our remote database server is setup to Enable DTC access, because we are using similar transactions in other projects built with Visual Studio 2008 on Windows XP and Vista. I think there is something specific about Windows 7 and Visual Studio 2010 causing this problem, but haven't been able to find out what it is. Can anyone help with this problem?
I just saw a post on the web from another programmer having this problem (http://www.pcreview.co.uk/forums/thread-3977150.php), he says it works fine on Windows 7 - x86, but gets this error on Windows 7 - x64. I'm running the x64 version of Windows 7, does anyone know if there are problems with MSDTC on Windows 7 - 64 bit version?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,我在对 SQL Server Service Broker 的 Receive 调用中保持数据库连接处于打开状态,然后尝试与数据访问层建立新连接。这就是导致问题的原因,解决方法是在打开第二个连接之前关闭第一个连接。
It turned out that I was leaving a database connection open in my Receive call to the SQL Server Service Broker, then trying to make a new connection to my data access layer. That was causing the problem, the fix turned out to be to close the first connection before opening the second one.