COM+包含事务的类调用时的-2147164157错误原因和解决

当在COM+中调用包含事务的类并创建其他COM+对象时,遇到错误-2147164157。错误源于COM+事务不支持嵌套,尤其是在不同包之间。解决方法是将所有组件放入同一个COM+应用程序包内,避免跨包调用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

COM+包含事务的类调用时的-2147164157错误原因和解决

 

一个需要事务的类每次当创建另一个COM+对象时就出现如下错误:

Method '~' of object '~' failed

错误号:-2147164157

 

调试良久,终不得其解,google新闻组搜索,得到下面信息

 

Error Number: 
   0x8004E003   ( -2147164157 )
Error Description: 
   You made a method call on a COM+ component 
   that has a transaction that has already aborted or 
   in the process of aborting.
 
    
    
This can be caused by two things that are known at this time:  
 
    
    
1)  SetComplete has been called after SetAbort was already called in the
transaction, and then a method of the object in the transaction is called  
 
    
    
2)  The method on the object is called when the transactions has been 
cleaned
up due to a transaction timeout.
 
    
    
*** TRY THIS *** 
1)  After Calling SetAbort() raise an error (Err.Raise) to the caller so 
they can handle
the abort correctly  2)  Increase the transaction timeout for long queries, 
or updates.
 
    
    
According to your description, you are pretty sure Child calls SetAborts 
and Parent calls SetAborts. However its important to manually raise the 
error from the child using Err.Raise after calling SetAbort.
 
    
    
Also, if you are using W2K, install SP1

 

 

以上信息似乎对我还是没有用,突然间我想到COM+的事务管理不支持嵌套,那么会不会在不同的包(package)之间其事务边界(bound)已经失效呢?因为我为了安装代理包方便,把组件按照功能和类型放在了不同的COM+应用程序中,这样的话就有了跨包(package)的调用和创建对象,当不使用事务时,没有什么问题;一旦在事务中调用和创建,便出现如上错误。我原来也碰到过这个情况,当时以为是COM+的事务不支持跨计算机的调用,现在终于明白了。

 

解决方法:把组件全部放在一个包内,调试通过。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值