Transactions with ASP.net WEB API

If you control both ends of the wire, it's possible to achieve what you want.

The TransactionInterop class exists to provide support for working with transactions between process boundaries, leveraging MS DTC.

It contains two methods which are interesting to your scenario:

  • GetTransmitterPropagationToken - This gets a token which can be used to propagate the transaction outside of the current process.

  • GetTransactionFromTransmitterPropagationToken - This takes a propagation token and uses it to construct the transaction in the local service.

You can use the first method in your client to generate a transaction. You can set it as a custom header value or a cookie to pass it to your service. Once on the service, you can use the second method to create the transaction locally.

The major caveat to this is that MS DTC will need to be enabled and configured at client and server. This is only really achievable if your services are being invoked within a Windows Active Directory Domain.


Enlisting service calls in transactions is generally thought of as a SOAP behaviour not a REST behaviour. At least there is a standardised way of doing it with SOAP called WS-AtomicTransaction.

Being SOAP oriented, this is not explicitly supported by the ASP.Net Web API, but it is supported by WCF

http://msdn.microsoft.com/en-us/library/ms730266

It would be possible to implement similar a similar behaviour yourself in REST, but it is relatively complex to do reliably.


I believe you are referring to distributed transactions (via MSDTC) which can propagate over service boundaries.

However, distributed transactions over WCF RESTful services are not possible because there is simply no way to propagate and manage the transaction state over plain HTTP requests.

You may want to look into plain WCF services, over HTTP (wsHttpBinding) or TCP/IP (net.tcp), or even give a look on WCF Data Services.