Please enable Javascript to correctly display the contents on Dot Net Tricks!

Understanding Session Management in WCF

  Author : Shailendra Chauhan
Updated On : 26 Sep 2016
Total Views : 56,665   
Support : All WCF
 

WCF manage session by creating the instance of the service class. These created instance(s) handle the incoming service request. In WCF, session is the way of managing the services instance(s) so that server can used these instances in an optimized way. At server side InstanceContext class is used to manage service class instance.

In WCF, there are three Instance Management way as given below:

  1. Per Call

    In this way, each request is served by a new service instance. It means a new service instance is created for each request and destroyed after the request is served.

    This make your WCF service stateless means you can’t maintain states between WCF calls.

  2. Per Session

    In this way, each and every client requests are served by a new single service instance. It means a new service instance is created for a client all requests and destroyed after the client finished its activity.

    This way make your WCF service state-full means you can maintain states between WCF calls.

  3. Single

    In this way, all clients’ requests are served by a single service instance. It means a single service instance is created to handle all the clients’ requests and never destroyed after serving the request.

    This makes your WCF service data shared globally.

How WCF Session is different from Asp.Net Session?

WCF Session management is different from Asp.Net Session Management in the following ways:

  1. WCF Sessions are created and terminated by service client.

  2. Server use session to manage service instances, not to store some general data like Asp.Net.

  3. WCF Session does not mainly rely on Session ID like Asp.Net, a particular field with in the header or body of a group of messages can also be considered as a part of session.

  4. There may be different Session ID at client and server side unlike Asp.Net.

What do you think?

I hope you will enjoy the tips while programming with WCF. I would like to have feedback from my blog readers. Your valuable feedback, question, or comments about this article are always welcome.


YOU MIGHT LIKE
Free Interview Books
 
COMMENTS (0)
13 FEB
ASP.NET Core Development (online)

07:00 AM-09:00 AM IST( MON, WED, FRI)

Know More
25 JAN
Angular2 and Angular1 Development (online)

09:00 PM-10:30 PM IST(MON-FRI)

Know More
24 JAN
ASP.NET MVC with Angular2 Development (online)

07:00 AM-09:00 AM IST(Tuesday & Thursday)

Know More
20 JAN
NODEJS & MEAN Stack 2 Development (online)

09:00 PM-11:00 PM IST( MON, WED, FRI)

Know More
15 JAN
PPC Marketing (offline)

04:00 PM-05:300 PM

14 JAN
Xamarin Forms : Build Cross-platform Apps (offline)

05:00 PM-06:30 PM IST

10 JAN
ASP.NET MVC with AngularJS Development (online)

09:00 PM-11:00 PM IST on (TUE, THRU,SAT)

3 JAN
ASP.NET MVC with AngularJS Development (online)

07:00 AM-09:00 AM IST

31 DEC
ASP.NET MVC with AngularJS Development (offline)

09:30 AM-11:00 AM

31 DEC
Angular2 and Angular1 Development (offline)

11:00 AM-12:30 AM

26 NOV
ASP.NET MVC with AngularJS Development (offline)

03:00 PM-04:30 PM

5 NOV
ASP.NET MVC with AngularJS Development (offline)

08:00 AM-09:30 AM

4 SEP
MEAN Stack 2 Development (offline)

11:00 AM-12:30 PM.

BROWSE BY CATEGORY
 
RECENT ARTICLES
SUBSCRIBE TO LATEST NEWS
 
LIKE US ON FACEBOOK
 

Professional Speaks

+