Hi, I have a service constructor for my WCF service. Which ideally should only be initialized once. But I see that the service constructor is called every few minutes. Is there some kind of temporary value or some other configuration parameter that could limit the number. constructor calls.
Creating a WCF service class (and therefore calling a constructor) depends on InstanceContextMode services . Depending on its value (for example, PerCall, PerSession, Single), service instances are created.
You can set a value Singlethat makes the class action similar to a singleton.
Single
, .
, , , WCF. WCF (PerCall, PerSession Single)
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
, , , .