Should I always disable the WCF service between calls?

I use the WCF service to administer a Windows service running on a remote machine. We have an administration client that we use to change the configuration of a Windows service, as well as to monitor the status of the service in real time. For real-time monitoring, we conduct a service survey for each state.

Currently, we leave the client connected all the time when monitoring the service, but I constantly read that it is recommended to connect and disconnect for each call, as well as for the database.

Would it be recommended in our situation, when we often turn to the service, or connect and disconnect add too much service data to the process?

thank

+3
source share
1 answer

By default and as a recommended best practice, you use activation for every call in WCF, for example. each request to your WCF service receives a new instance of the service class, this instance processes your request, returns the result, and then is deleted.

In this case, I really do not see any reason to constantly break and restore the communication channel (for example, permanently delete and recreate the proxy client). On the WCF service side, nothing happens, “lingers” in memory and takes up resources or something like that. In addition, contrary to most databases, there is usually no “connection license” or something like that.

, , , " ", . - - , . , .

, WCF, .

+1

Source: https://habr.com/ru/post/1788024/


All Articles