The InstanceContextMode Property
You can apply the ServiceBehavior attribute with the InstanceContextMode property set to the following:
- InstanceContextMode.PerCall - Per-Call Services.
- InstanceContextMode.PerSession - Per-Session Services, default.
- InstanceContextMode.Sharable - Shareable Services, not included in the current release.
- InstanceContextMode.Single - Singleton Services, with sessions or without sessions.
A service that implements a session-aware contract requires that all the endpoints that expose the contract use bindings that support reliable transport session. One exception to this rule is the named pipes binding.
A shareable service behaves much like a per-session service, with one important additional aspect: the instance has a unique ID, and when a client establishes a session with a shareable service, the client can pass a logical reference to that instance to another client. The second client will establish an independent session but will share the same instance. Also, each of these sessions may use different inactivity timeouts, and expire independently of any other session.
WCF Essentials: Discover Mighty Instance Management Techniques For Developing WCF Apps by Juval Lowy.
0 Comments:
Post a Comment
<< Home