WCF Service Designer

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.

+3
source share
2 answers

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.

+1

, .

, , , WCF. WCF (PerCall, PerSession Single)

[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)] 

, , , .

+1

All Articles