CommunicationObjectAbortedException & CommunicationObjectFaultedException in WCF Service

后端 未结 2 1919
难免孤独
难免孤独 2021-02-14 08:42

I am working on a system based on the publisher subscriber pattern. I have a WCF service that is running in a WPF application. There are numerous clients which connect to the se

2条回答
  •  面向向阳花
    2021-02-14 09:09

    Based on what you have shown it looks like you open the WCF channel (create the client) when you start the app, and then do not close it until the app closes.

    There are several problems with this approach. The one that you are running into is that any disruption on the network or server will cause the channel to be unusable.

    The way to do it is that everytime you need to make a WCF call you open the channel, make the call and then close the channel.

    This approach gives both a more robust as well as a more scalable solution.

提交回复
热议问题