被com+彻底打败:此事务已明地或暗地被确认或终止

steeven 2004-03-25 05:45:38
windows2003 + biztalk2004 数据库不在本机。
已经在组件服务中打开了本地的安装安全设定

System.Runtime.InteropServices.COMException (0x8004D00E): 此事务已明地或暗地被确认或终止

代码如下:
[WebMethod(TransactionOption=TransactionOption.RequiresNew)]
public string HelloWorld()
{
SqlConnection conn = new SqlConnection("server=192.168.0.4;database=abc;uid=sa;pwd=;");
string sql = "INSERT INTO Book (book_name) VALUES ('test')";
SqlCommand cmd = new SqlCommand(sql,conn);
conn.Open();
conn.EnlistDistributedTransaction(ContextUtil.Transaction as ITransaction);
int i = cmd.ExecuteNonQuery();
conn.Close();
}

这段代码在win2k下面运行正常。

为什么2003上就死活不行呢?
...全文
285 20 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
bpy_r 2004-06-24
  • 打赏
  • 举报
回复
gz
seven 2004-06-14
  • 打赏
  • 举报
回复
关注
coollzh 2004-05-10
  • 打赏
  • 举报
回复
我在windows2000上也使同样的错误,用Enlist=false,然后conn.EnlistDistributedTransaction(ContextUtil.Transaction as ITransaction);
然就报同样的错误!
zs1024cn 2004-05-05
  • 打赏
  • 举报
回复
我的经验是将win2003的IIS里设置网站的有一个什么defaultpool,什么池的,然后设置为本地方式,因为在网吧,记不大清了,你自己试试吧,总之是改IIS的运行权限方面的问题。
lihao9806 2004-05-03
  • 打赏
  • 举报
回复
conn.EnlistDistributedTransaction(ContextUtil.Transaction as ITransaction);
这行代码是没用的。
只要没有异常抛出会自动SetComplete的,否则会自动SetAbort。
wolftop 2004-05-03
  • 打赏
  • 举报
回复
UP~!UP!~
qqchen79 2004-04-30
  • 打赏
  • 举报
回复
This might prove what I said:

From MSDN:
CAUTION EnlistDistributedTransaction returns an exception if the OdbcConnection has already started a transaction using BeginTransaction. However, if the transaction is a local transaction started at the data source (for example, by explicity executing the BEGIN TRANSACTION statement using an OdbcCommand object), EnlistDistributedTransaction rolls back the local transaction and enlists in the existing distributed transaction as requested. You will not receive notice that the local transaction was rolled back, and are responsible for managing any local transactions not started using BeginTransaction.

==============================
http://blog.joycode.com/qqchen
qqchen79 2004-04-30
  • 打赏
  • 举报
回复
如果你的WebMethod已经声明是TransactionOption.RequiresNew,那么WebMethod里面的数据库事务应该会被自动enlist到COM+ Transaction里面,不需要显示的Enlist了。
可以试试看吧conn.EnlistDistributedTransaction调用去掉。

I'm not an expert on Transaction, so I may be wrong...

==============================
http://blog.joycode.com/qqchen
coollzh 2004-04-29
  • 打赏
  • 举报
回复
up
zblaoshu1979 2004-04-21
  • 打赏
  • 举报
回复
up
commars 2004-04-13
  • 打赏
  • 举报
回复
UP!
seven 2004-04-12
  • 打赏
  • 举报
回复
看看是不是权限出了问题,2003 对权限的管理更细了。。
caiyajun512 2004-04-11
  • 打赏
  • 举报
回复
1.SqlConnection conn = new SqlConnection("server=192.168.0.4;database=abc;uid=sa;pwd=;");
修改如下(Enlist=false):
SqlConnection conn = new SqlConnection("server=192.168.0.4;database=abc;uid=sa;pwd=;Enlist=false;");
2.可能你的com有问题
EastenChild 2004-04-09
  • 打赏
  • 举报
回复
.net 2003修复安装 不行重装 另外去microsoft.com去看看有无sp可down
gengwei80 2004-04-08
  • 打赏
  • 举报
回复
up
steeven 2004-04-07
  • 打赏
  • 举报
回复
晕,数据库在同一台机器上就可以。
@#¥^%^&@¥@#!
xielk 2004-03-30
  • 打赏
  • 举报
回复
2003我也出现过不能注册组件,到现在还没解决
tongcheng 2004-03-30
  • 打赏
  • 举报
回复
up
rottenapple 2004-03-30
  • 打赏
  • 举报
回复
没用过2003
差距怎么会这么大?
都是一个娘生的,呵呵
huangsuipeng 2004-03-25
  • 打赏
  • 举报
回复
无用windows2003
帮你顶一下

12,166

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧