How to Configure a Client Application to Flow Transactions in WCF?

You must configure both the client application and the server bindings so that the transaction context flows from the client application to the service. The transactionFlow property of the binding that is used by the client application endpoint in the configuration file must be set to true and the type of transaction that is specified in the binding must match the type that is specified on the service side.

The following code example shows how to configure a client application to flow transactions to a service.

<client>

  <endpoint address="http://localhost:8080/BankService"

            binding="wsHttpBinding"

            bindingConfiguration="BankServiceWSBinding"

            contract="IBank"/>

</client>

<bindings>

  <wsHttpBinding>

    <binding name="BankServiceWSBinding"

             transactionFlow="true"

             ...

  </wsHttpBinding>

</bindings>

Alternatively, you can set the transactionFlow property programmatically.

The following example shows how to set the TransactionFlow property for a wsHttpBinding programmatically.

[Visual Basic]

...

 

Dim wsBinding As New WSHttpBinding()

wsBinding.TransactionFlow = True

 

...

 

[Visual C#]

...

 

WSHttpBinding wsBinding = new WSHttpBinding( );

wsBinding.TransactionFlow = true;

 

...

 

For more information, see Windows Communication Foundation Transactions Overview and Enabling Transaction Flow.