CommunicationObjectAbortedException & CommunicationObjectFaultedException in WCF Service

后端 未结 2 1908
难免孤独
难免孤独 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:08

    After some research, i have solved this issue myself. The problem was that whenever my client disconnected unexpectedly without properly unsubscribing, and the service was not properly taking care of the dropped client. So the communciation object became faulted. Lee's answer to this question really helped me think in the right direction. Upon some more research then, i found this discussion pretty useful in solving the problem.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题