Reputation: 34208
i am very new in WCF. so often gaze for wcf code & article. after viewing many code i often stuck for very basic things and got no elaborate discussion for the below question. so here are my few basic question....and looking for details discussion with sample situation and with sample code.
what is InstanceContextMode? many people use InstanceContextMode Single or PerCall or PerSession ?
i just need deep insight when i should go for InstanceContextMode Single or or PerCall or PerSession ? what it does basically ??
tell me briefly when i woul turn on Single what will happen or what will happen in case of PerCall or PerSession ? what is difference between Single or PerCall or PerSession
what is default InstanceContextMode ?
Upvotes: 0
Views: 345
Reputation: 2267
The InstanceContextMode property indicates how WCF will create instances of your service class and whether those instances will be reused across requests.
Multiple
.For high-volume stateless services, using Single
and ConcurrencyMode.Multiple
can reduce the number of service instances allocated and the associated pressure on the garbage collector. WCF doesn't require/assume that your service is stateless, though, which is why PerSession
is the default.
You can verify the behavior of the different instance context modes by setting a breakpoint in your service's default constructor.
Upvotes: 2