是否存在围绕多个 Web 服务调用的任何事务?
几天前我在 stackoverflow 和 ASP.net 论坛上问了这个问题。 我得到的答案是“不,这是不可能的。交易不能超越网络服务边界” 是否存在围绕多个 Web 服务调用的事务?
但在 ASP 中.net论坛我得到了以下答案: http://jalpesh.blogspot.com/ 2010/05/using-transactions-with-linq-to-sql.html 它提供system.transaction
。 你对此有何建议?
A few days ago I asked this question in stackoverflow and ASP.net forums.
the answer which I got was "No, this is not possible. Transactions cannot go past web service boundaries"
Are there any transactions around multiple webservice calls?
but in ASP.net forum I got the answer below:
http://jalpesh.blogspot.com/2010/05/using-transactions-with-linq-to-sql.html
it's offering system.transaction
.
what is your suggestion about it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
上述问题的答案是,在一般情况下,不同的 Web 服务可能参与同一事务。为此,您可以使用行业标准 WS-Transaction,它是 WS-Coordination 规范。感兴趣的规范是 WS-原子事务 (WSAT)。
如果您在 Microsoft 堆栈上运行并且在所有计算机之间正确配置了 MSDTC,则可以在 Web 服务之间传递事务(请参阅 跨 AppDomains 传播事务。
所以,答案是肯定的,这是可能的但是,一般来说,如果您正在谈论围绕任意第三方服务合并交易(正如您之前的问题所示),那么这是不可能的,因为这些第三方服务很可能不支持。 WSAT(我不会责怪他们!)。
不幸的是,在这些情况下,如果发生失败,您所能期望的最好的结果就是执行补偿操作。
The answer to the above question is that in the general case it is possible to have disparate web services participate in the same transaction. To do this you would use the industry standard WS-Transaction which is part of the WS-Coordination specification. The specification of interest is WS-Atomic Transaction (WSAT).
If you are running on a Microsoft stack and have MSDTC configured properly between all machines then it is possible to pass transactions between web services (see Propagating a Transaction Across AppDomains.
So, the answer is yes, it is possible in general. However, if you are talking about incorporating transactions around arbitrary third party services (as your previous question appears to be about) then that is probably not possible because most likely those third party services do not support WSAT (and I don't blame them!).
Unfortunately, in these scenarios, the best you can hope for in the event of failure is to execute compensating actions.
LINQ to SQL 实际上与围绕 Web 服务调用的事务无关。
我记得读过这样的内容:http://en.wikipedia.org/wiki/WS-Transaction 但不知道任何实现的状态。所以我不会说它不能做到,但如果可能的话,根据参与规范的公司,这将是非常昂贵和非常复杂的。
LINQ to SQL really has nothing to do with transactions around web service calls.
I remember reading about this: http://en.wikipedia.org/wiki/WS-Transaction but have no idea of the state of any of the implementations. So I won't say it can't be done, but if it is possible, based on the companies involved in the spec, it will be very expensive and very complex.