Wcf session ensure all messages being exchanged between client & service are the part of same conversation.
1. does not store any data like asp.net session state .
2. always created by client not by service.
3. not even mandataory, client have the session id as service session id, both are related by correlated id.
There are three thing to be configured for WCF Session:
1. Binding: Not all bindings support session, so selecting correct binding required. opting out binding not support session will throw exception.
2. Session Mode: Session Mode can be set to service contract with the following options:
A). Allowed: service accepts sessionful client and sessionless as well and its default mode.
B). Required : service accepts request from sessionful clients only.
C). NotAllowed. Service accepts request from sessionless Client only.
3. InstanceContextMode: This is service behaviour controls the instantiation of service clss. It can be set to
A). Per call: each client call served by new service instance.
B). Per session: all the call coming from same client served by same instance means service instance created for each client.
C). Singleton: All client request served by single service instance.