如何在 SQL Server 上启用 MSDTC?
这甚至是一个有效的问题吗? 我有一个使用 MSTDC 的 .NET Windows 应用程序,它抛出异常:
System.Transactions.TransactionManagerCommunicationException:分布式事务管理器 (MSDTC) 的网络访问已被禁用。 请启用 DTC 使用组件服务管理工具在 MSDTC 的安全配置中进行网络访问 ---> System.Runtime.InteropServices.COMException(0x8004D024):事务管理器已禁用其对远程/网络的支持 交易。 (HRESULT 异常:0x8004D024)位于 System.Transactions.Oletx.IDtcProxyShimFactory.ReceiveTransaction(UInt32) propgationTokenSize、Byte[] propgationToken、IntPtr 托管标识符、 指导& transactionIdentifier、OletxTransactionIsolationLevel& 隔离级别、ITransactionShim& 交易垫片)....
我按照 Kbalertz 指南在 PC 上启用 MSDTC安装了该应用程序,但仍然出现错误。
我想知道这是数据库问题吗? 如果是这样,我该如何解决?
Is this even a valid question? I have a .NET Windows app that is using MSTDC and it is throwing an exception:
System.Transactions.TransactionManagerCommunicationException: Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable DTC for
network access in the security configuration for MSDTC using the Component Services Administrative tool ---> System.Runtime.InteropServices.COMException (0x8004D024): The transaction manager has disabled its support for remote/network
transactions. (Exception from HRESULT: 0x8004D024) at System.Transactions.Oletx.IDtcProxyShimFactory.ReceiveTransaction(UInt32
propgationTokenSize, Byte[] propgationToken, IntPtr managedIdentifier,
Guid& transactionIdentifier, OletxTransactionIsolationLevel&
isolationLevel, ITransactionShim& transactionShim)....
I followed the Kbalertz guide to enable MSDTC on the PC on which the app is installed, but the error still occurs.
I was wondering if this was a database issue? If so, how can I resolve it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
@担,
仅分布式事务 - 涉及多个连接的事务。 请双重确保您只在事务中打开一个连接,并且它不会升级 - 性能也会好得多。
@Dan,
Only distributed transactions - Those that involve more than a single connection. Make doubly sure you are only opening a single connection within the transaction and it won't escalate - Performance will be much better too.
MSDTC 可以使用 MsDtc PowerShell 模块进行配置,例如:
在每台将支持分布式事务的计算机上运行(即运行 MSDTC 服务的计算机)。
MSDTC can be configured with MsDtc PowerShell module, e.g.:
Run on each of the machines that will be supporting the distributed transactions (i.e. where the MSDTC service is running).
必须在服务器和客户端这两个系统上启用 MSDTC。
另外,请确保系统之间不存在阻止 RPC 的防火墙。
DTCTest 是一个很好的小应用程序,可以帮助您解决任何其他问题。
MSDTC must be enabled on both systems, both server and client.
Also, make sure that there isn't a firewall between the systems that blocks RPC.
DTCTest is a nice litt app that helps you to troubleshoot any other problems.
您还需要 MSDTC 吗? 您遇到的升级通常是由于在单个 TransactionScope 内创建多个连接引起的。
如果您确实需要它,那么您需要按照错误消息中的概述启用它。 在 XP 上:
Do you even need MSDTC? The escalation you're experiencing is often caused by creating multiple connections within a single TransactionScope.
If you do need it then you need to enable it as outlined in the error message. On XP:
我发现最好的调试方法是使用名为 DTCPing
我在我们的旧公司网络中遇到了很多问题,我有一些提示:
根据我的经验,如果 DTCPing 能够建立从客户端发起和从服务器发起的 DTC 连接,那么您的事务就不再是问题了。
I've found that the best way to debug is to use the microsoft tool called DTCPing
I've had my fare deal of problems in our old company network, and I've got a few tips:
In my experience, if the DTCPing is able to setup a DTC connection initiated from the client and initiated from the server, your transactions are not the problem any more.
还可以在此处查看如何从控件打开 MSDTC面板的 services.msc。
Can also see here on how to turn on MSDTC from the Control Panel's services.msc.
对于 Windows Server 2008 r2 和 Windows Server 2012 R2 使用此
单击开始,单击运行,键入dcomcnfg,然后单击确定打开组件服务。
在控制台树中,单击展开组件服务,单击展开计算机,单击展开我的电脑,单击展开< strong>分布式事务协调器,然后单击本地 DTC。
右键单击本地 DTC,然后单击属性以显示本地 DTC 属性对话框。
单击安全选项卡。
选中“网络 DTC 访问”复选框。
最后选中“允许入站”和“允许出站”复选框。
单击应用、确定。
将会弹出一条关于重新启动服务的消息。
单击确定即可。
参考:https://msdn.microsoft.com/en-us/library/dd327979 .aspx
注意:有时,本地计算机或服务器上的网络防火墙可能会中断您的连接,因此请确保您创建“允许入站” 和 < strong>“允许出站”连接
C:\Windows\System32\msdtc.exe
Use this for windows Server 2008 r2 and Windows Server 2012 R2
Click Start, click Run, type dcomcnfg and then click OK to open Component Services.
In the console tree, click to expand Component Services, click to expand Computers, click to expand My Computer, click to expand Distributed Transaction Coordinator and then click Local DTC.
Right click Local DTC and click Properties to display the Local DTC Properties dialog box.
Click the Security tab.
Check mark "Network DTC Access" checkbox.
Finally check mark "Allow Inbound" and "Allow Outbound" checkboxes.
Click Apply, OK.
A message will pop up about restarting the service.
Click OK and That's all.
Reference : https://msdn.microsoft.com/en-us/library/dd327979.aspx
Note: Sometimes the network firewall on the Local Computer or the Server could interrupt your connection so make sure you create rules to "Allow Inbound" and "Allow Outbound" connection for
C:\Windows\System32\msdtc.exe