Home > Articles > WCF Articles > How to configure session in WCF ?

How to configure session in WCF ?

by SARNAM SINGH   on Apr 26, 2016   Category: WCF  | Level: Intermediate  |  Views: 417    |  Points: 100   
Like this article? Bookmark and Share:
Wcf session ensure all messages being exchanged between client & service are the part of same conversation. There are three thing to be configured for WCF Session

Wcf session ensure all messages being exchanged between client & service are the part of same conversation.

WCF session

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.



Like this article? Bookmark and Share:

Most viewed Articles

User Comments


No response found, be the first to review this article.

Submit feedback about this article

Please sign in to post feedback

Latest Posts