Google News
logo
WCF - Interview Questions
What is Instance Management in WCF?
WCF manages the session by creating the instance of the service class. This created instance(s) handle the incoming service request. In WCF, the session is the way of managing the services instance(s) so that the server can use these instances in an optimized way. At the server side, the InstanceContext class is used to manage service class instance.

There are following instance management ways :
 
Per Call : A new instance will be created for each request from the same client or a new one, which means that every request will be a new request. Although this mode is most efficient in terms of memory, a session still needs to be maintained.  

Per Session : A new instance would be created for each new client session, and the scope of that object would correspond to the scope of that session. 
 
Single Instance : For each service object, only one instance will be created for all requests, regardless of whether they are coming from the same client or not. This is the least efficient instance mode in terms of memory usage.
Advertisement