none
a call from WCF Client using a distributed transaction on one workstation blocks all WCF Clients that use the same WCF Service from different workstation for an extended period of time? RRS feed

  • Question

  • Aside from removing the TransactionScope created on the WCF client (and effectively taking msdtc out of the picture), Is there an alternate way to avoid the excessively long WCF-service-wide hang when a single workstation hosting the WCF client is misconfigured (or experiencing communications issues)? 

    We have a simple WCF service implemented using C#, and a simple WCF Client which creates TransactionScope before invoking the WCF service proxy. 

    Both work fine as far as concurrency goes if Windows Firewall allows TCP communication from/to msdtc.exe thru firewall. However if a single workstation is misconfigured (i.e. has firewall enabled, and has an Inbound Rule for TCP for msdtc.exe disabled), its attempt to communicate with the service will block all other WCF clients (which are properly configured) from communicating with the WCF Service for at least 41 seconds (given the currect settings for TCP retransmissions), despite us using much shorter timeout settings for the WCF binding as well as for the TransactionScope timeout.     

     The WCF service is decorated with
        [System.ServiceModel.ServiceBehavior(
            InstanceContextMode = System.ServiceModel.InstanceContextMode.PerCall,
            ReleaseServiceInstanceOnTransactionComplete = false,
            ConcurrencyMode = System.ServiceModel.ConcurrencyMode.Multiple,
            IncludeExceptionDetailInFaults = false,
            TransactionTimeout = "00:00:13"
           )
    The WCF service has a single operation contract, decorated with [System.ServiceModel.TransactionFlow(System.ServiceModel.TransactionFlowOption.Mandatory)] in the class interface.In the class itself, the same method is decorated with [System.ServiceModel.OperationBehavior(TransactionScopeRequired = true)].

    The WCF service is hosted using a Windows console application which uses a netTcpBinding configured with  transactionFlow="true"  transactionProtocol="OleTransactions"  sendTimeout="00:00:20"  receiveTimeout="00:00:20"

    The service is accessed from a Windows Forms client application configured with the following values for its netTcpBinding:
                             transactionFlow="true"
                             transactionProtocol="OleTransactions" 
                             transferMode="Streamed" 
                             sendTimeout="00:00:20"
                             receiveTimeout="00:00:20"
    Thursday, June 21, 2018 8:53 PM

All replies

  • Why is a WCF client doing transactions? DTC should be between machine hosting  the service and the machine hosting the database. There should be a Repository or DAL sitting behind the WCF service that does transaction scope for add, update or delete.
    Friday, June 22, 2018 3:47 AM
  • We have a legacy system originally developed as COM+ C++app, which was later on combined with a newer functionality implemented using C# and .NET remoting, and the .Net remoting got replaced by WCF in more recent history. While we understand it is probably time for a more significant refactoring (eliminate the need for the client-initiate transaction), we wanted to make sure we are not overlooking some cheaper (quicker-to-implement) alternative.

    Friday, June 22, 2018 12:20 PM
  • Hi JiriWpg,

    Thanks for your post.

    I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.
     
    Sorry for any inconvenience and have a nice day!

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, June 25, 2018 6:50 AM
  • It is great to hear senior engineers might look into it. Have a nice day as well!
    Monday, June 25, 2018 3:52 PM
  • Hi,

    First of all since you configure the transaction protocol to OleTransaction, I assume a client app will call your WCF service to propagate the transaction, so in this circumstance msdtc.exe will be enlisted to handle the transaction because the transaction is across the application domain.

    Secondly you have set the transactiontimeout to 13 sec, it should throw timeout exception. So you can enable WCF trace on both the client side and server side to see where 41 sec has been spent.

    Zhiqing 


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Thursday, July 5, 2018 4:20 PM