How to handle WCF exceptions (consolidated list with code)

前端 未结 4 776
名媛妹妹
名媛妹妹 2020-12-02 04:32

I\'m attempting to extend this answer on SO to make a WCF client retry on transient network failures and handle other situations that require a retry such as authentication

4条回答
  •  猫巷女王i
    2020-12-02 05:23

    I started a project on Codeplex that has the following features

    • Allows efficient reuse of the client proxy
    • Cleans up all resources, including EventHandlers
    • Operates on Duplex channels
    • Operates on Per-call services
    • Supports config constructor, or by factory

    http://smartwcfclient.codeplex.com/

    It is a work in progress, and is very heavily commented. I'll appreciate any feedback regarding improving it.

    Sample usage when in instance mode:

     var reusableSW = new LC.Utils.WCF.ServiceWrapper(channelFactory);
    
     reusableSW.Reuse(client =>
                          {
                              client.CheckIn(count.ToString());
                          });
    
    
     reusableSW.Dispose();
    

提交回复
热议问题