By default, WCF uses "Per-Call", which means that a new instance of the WCF service is created for each client call. Now that you have implemented singleton, even if you created a new instance of WCF, it still calls your singleton.
If you want to create a search created for each call (for example, you have one), you should not do this as a singleton. This way, every client that calls your method will have a new search instance, I think that was your intention.
However, if you have a search that doesn't change so fast, I would recommend sharing it between all the calls, which will improve the performance of your WCF service. You will need to declare your WCF service as
InstanceContextMode = InstanceContextMode.Single ConcurrencyMode = ConcurrencyMode.Multiple
This means that it automatically creates Singleton automatically for WCF, so you do not need to do this yourself, and secondly, it will support> 1 concurrent user (ConcurrencyMode.Multiple).
Now, if you have your search that is changing and needs to be reloaded after a certain period of time, I would recommend using
InstanceContextMode = InstanceContextMode.Single ConcurrencyMode = ConcurrencyMode.Multiple
but inside in your code cache, and then your cache expires at a specific time or relative time (1 hour).
Here are some links that may help you: 3 ways to manage a WCF instance (per call, per session, and single)
Hope this helps.
Vlad Bezden
source share