针对Sql Server 2000的TransactionScope错误-合作伙伴事务管理器已禁用其对远程/网络事务的支持 [英] TransactionScope Error against Sql Server 2000 - The partner transaction manager has disabled its support for remote/network transactions

查看:180
本文介绍了针对Sql Server 2000的TransactionScope错误-合作伙伴事务管理器已禁用其对远程/网络事务的支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试针对我的Sql 2000数据库为Linq-to-Sql操作设置一个简单的事务.使用TransactionScope看起来像这样:

I am trying to set up a simple transaction for my Linq-to-Sql actions against my Sql 2000 database. Using TransactionScope it looks like this:

using (TransactionScope transaction = new TransactionScope())
{
    try
        {
        Store.DBDataContext dc = new Store.DBDataContext();
        Store.Product product = GetProduct("foo");
        dc.InsertOnSubmit(product);
        dc.SubmitChanges();
        transaction.Complete();
    }
    catch (Exception ex)
    {                
        throw ex;
    }
}

但是,我不断收到以下错误消息:

However, i keep getting the following error:

合作伙伴事务管理器已禁用对远程/网络事务的支持. (来自HRESULT的异常:0x8004D025)

但是,如果我使用传统交易来设置交易,那么它可以正常工作.这样就可以正常工作:

But, if I set up the transaction using a traditional transaction, it works fine. So this works fine:

Store.DBDataContext dc = new Store.DBDataContext();
try
{
    dc.Connection.Open();
    dc.Transaction = dc.Connection.BeginTransaction();
    Store.Product product = GetProduct("foo");
    dc.InsertOnSubmit(product);
    dc.SubmitChanges(); 
    dc.Transaction.Commit();
}
catch (Exception ex)
{
    dc.Transaction.Rollback();
    throw ex;
}
finally
{
    dc.Connection.Close();      
    dc.Transaction = null;
}

我想知道TransactionScope在幕后是否比我的第二个实现有所不同.如果没有,不使用TransactionScope会给我带来什么损失?同样,关于导致错误的原因的任何指导也将是很好的.我已经确认MSDTC在sql服务器和客户端计算机上都在运行.

I'm wondering if the TransactionScope is doing something different under the covers than my second implementation. If not, what am I losing by not using TransactionScope? Also, any guidance on what is causing the error would be good too. I've confirmed that MSDTC is running in both sql server and on my client machine.

推荐答案

在这里看看:

使用System.Transactions和Microsoft SQL Server 2000进行快速交易 http://blogs.msdn.com/florinlazar/archive/2005 /09/29/475546.aspx

Fast transactions with System.Transactions and Microsoft SQL Server 2000 http://blogs.msdn.com/florinlazar/archive/2005/09/29/475546.aspx

在这里:
http://forums.microsoft.com/MSDN/ShowPost.aspx ?PostID = 230390& SiteID = 1

首先验证分布式事务处理协调器"服务是否为 同时在数据库服务器计算机和客户端计算机上运行
1.转到管理工具>服务"
2.如果分布式事务处理协调器"服务未运行,则将其打开

First verify the "Distribute Transaction Coordinator" Service is running on both database server computer and client computers
1. Go to "Administrative Tools > Services"
2. Turn on the "Distribute Transaction Coordinator" Service if it is not running

如果正在运行,并且客户端应用程序不在同一台计算机上 数据库服务器,在运行数据库服务器的计算机上
1.转到管理工具>组件服务"
2.在左侧导航树上,转到组件服务>计算机>我的电脑"(您可能需要双击并等待某些节点 需要时间扩展)
3.右键单击我的电脑",选择属性"
4.选择"MSDTC"选项卡
5.单击安全配置"
6.确保选中网络DTC访问",允许远程客户端", 允许入站/出站",启用提示"(某些选项可能不是 必要,请尝试获取您的配置)
7.服务将重新启动
8.但是如果仍然无法正常工作,则可能需要重新启动服务器 (这是以前让我发疯的事情)

If it is running and client application is not on the same computer as the database server, on the computer running database server
1. Go to "Administrative Tools > Component Services"
2. On the left navigation tree, go to "Component Services > Computers > My Computer" (you may need to double click and wait as some nodes need time to expand)
3. Right click on "My Computer", select "Properties"
4. Select "MSDTC" tab
5. Click "Security Configuration"
6. Make sure you check "Network DTC Access", "Allow Remote Client", "Allow Inbound/Outbound", "Enable TIP" (Some option may not be necessary, have a try to get your configuration)
7. The service will restart
8. BUT YOU MAY NEED TO REBOOT YOUR SERVER IF IT STILL DOESN'T WORK (This is the thing drove me crazy before)

在您的客户端计算机上,使用与上述相同的步骤打开 在安全配置"设置中,确保选中网络DTC" 访问",允许入站/出站"选项,重新启动服务和计算机 如有必要.

On your client computer use the same above procedure to open the "Security Configuration" setting, make sure you check "Network DTC Access", "Allow Inbound/Outbound" option, restart service and computer if necessary.

在您的SQL Server服务管理器上,单击服务"下拉菜单,选择 分布式事务处理协调器",它也应该在 您的服务器计算机.

On you SQL server service manager, click "Service" dropdown, select "Distribute Transaction Coordinator", it should be also running on your server computer.

这篇关于针对Sql Server 2000的TransactionScope错误-合作伙伴事务管理器已禁用其对远程/网络事务的支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆