Dealing with WCF service restart on client-side

后端 未结 2 1468
猫巷女王i
猫巷女王i 2021-02-03 14:10

I\'ve got a GUI client which is running against a WCF services hosted as a Windows service on a server box. The WCF service is running in PerCall InstanceContextMode, and the cl

相关标签:
2条回答
  • 2021-02-03 14:16

    You can take a look at this to perhaps avoid some of that boilerplate code:

    http://wcfproxygenerator.codeplex.com

    0 讨论(0)
  • 2021-02-03 14:36

    The best would be to avoid the exceptions on the server all together. If a WCF Server encounters an exception that is not being caught and handled, it will "fault" the channel, rendering it useless.

    On the server side, you can implement the IErrorHandler interface and catch .NET exceptions, turning them into SOAP faults which will be handed back to the client more gracefully, without faulting the channel.

    That way, you can catch all .NET exceptions on the server, and convert them into interoperable SOAP faults which will not cause these problems.

    For more information, see:

    • Specifying and handling faults in contracts
    • WCF Error Handling and Fault Conversion
    0 讨论(0)
提交回复
热议问题