MSDTC 和具有实体框架的多个数据库
在我的代码中,我尝试将 TransactionScope 与实体框架结合使用。在此事务中,我们打开到单独服务器和数据库的常规 SQL 连接。当调用 conn.Open() 时,我们得到一个 错误:
“分布式事务管理器 (MSDTC) 的网络访问已被禁用。请使用 Componet 服务管理工具在 MSDTC 的安全配置中启用 DTC 的网络访问。”
但是,MSDTC 已启用并在服务器上运行。
In my code I'm attempting to use a transaction using TransactionScope with Entity Framework. While in this transaction we are opening a regular SQL connection to a seperate server and database. When the conn.Open() is called we get an
Error:
"Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable DTC for network access in the security configuration for MSDTC using the Componet Services Administrative tool."
However, MSDTC is enabled and running on the Server.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要在 Web 服务器和 SQL Server 上启用 MS DTC,并在两台计算机上启用远程事务。我有 Windows 2003 的演练 和 Windows 2008 在我的博客上。
You'll need to enable MS DTC on both the web server, and the SQL Server, as well as enable remote transactions on both machines. I've got walk throughs for Windows 2003 and Windows 2008 up on my blog.
还要检查防火墙。有一次,我在办公室里浪费了一整天的时间,因为我发现前一天晚上运行的 Windows 更新操作恢复了 Windows 防火墙的默认值。
Check also firewall. I once, lost a whole day in office, for discovering that the Windows Update operation, that had run the previous night, restored the default values of Windows Firewall.
1) 只是为了确定,但您是否确实确认 DTC 正在运行。在“组件服务”屏幕上右键单击“我的电脑”。顶部菜单项应显示“停止 DTC”。
2) 您是否检查过两端(启动数据库连接的应用程序服务器和数据库服务器)的 MSDTC 配置是否相同?
特别注意 MSTDC 选项卡下的安全配置
祝你好运
1) Just to be sure but have you really confirmed that DTC is running. Right mouse click on "My Computer" from your Component Services screen. The top menu item should say "Stop DTC".
2) Have you checked that your configuration of MSDTC is the same on both ends (your application server that initiates connection to the database and at your database server)?
Pay special attention to the Security Configurations under your MSTDC tab
Good luck