Where to trap failed connection on WCF calling class?

后端 未结 7 1211
失恋的感觉
失恋的感觉 2021-01-13 05:09

I\'m trying to write a class that encapsulates WCF calls (the client is Silverlight, if it matters). It all works swimmingly, but I\'m not sure how to trap a connection fail

7条回答
  •  半阙折子戏
    2021-01-13 05:33

    I think that the problem is in the way you have designed service caller.

    The channel is opened when service caller is created. This means that the channel can timeout and there is nothing in your code that can recover from the timeount.

    I would move the creation and closing of the channel to the make call method.

    You can do a try catch around the begin get and around the contents of the callback.

提交回复
热议问题