WCF basicHttpBinding: Rollback when reply to client fails

旧巷老猫 提交于 2019-12-03 07:32:45

There is no easy answer to this question. You are asking for a behaviour that is implemented in WS-* but done using basic SOAP. I think your only option if you REALLY can't switch to wsHttpBinding or use duplex as suggested by @Trevor Pilley is to try to mimic the behaviour of WS-Transaction in your own custom protocol based on basic SOAP.

You should be able to get some simplification over the full WS-Transaction specification because

  • You will probably only need to support transactions over a single service - you will not be doing a distributed transaction over several independent services
  • You will not need to support both short a transactions (WS-AtomicTransaction) as well as long running transactions (WS-BusinessActivity) probaby atomic transactions would do
  • You would not need to support any kind of extensibility model (WS-Coordination)
  • You would not need to implement a discovery/metadata model that describes the protocol (e.g. like WSDL) because you would be coding the protocol behaviour directly into the client and service.

However, you would probably need elements of both WS-Coordination and WS-AtomicTransaction. This is not a simple task by any means and it will be easy to miss something subtle that could cause either rollbacks to not happen or (just as bad) to destroy the performance of your service by having long duration locks all over your database due to crashed clients.

Like I say, this is a complex behaviour and if you cannot use ready-made, standardised protocols, there is no simple answer.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!