Support us .Net Basics C# SQL ASP.NET ADO.NET MVC Slides C# Programs Subscribe Buy DVD

StateServer session state mode management - Part 65

Suggested Videos
Part 62 - session state
Part 63 - Cookie less sessions in
Part 64 - Inporc session state mode management

In this video, we will discuss about the session state mode - StateServer. session state mode can have any of the following 4 values. session state mode is set in web.config file.
1. Off - Disables session state for the entire application.
2. InProc - Discussed in Part 64
3. StateServer - Will be discussed in this session.

The following session state modes will be discussed in a later video session.
4. SQLServer
5. Custom

When the session state mode is set to StateServer, the session state variables are stored in a process, called as state service. This process is different from the worker process. The state service can be present on a web server or a dedicated machine. 

Steps to follow, to configure web application to use StateServer:
1. Start the ASP.NET state Service. To start the state service
    a) Click Start > Type Run > Press Enter
    b) In the run window, type services.msc and click OK.
    c) In the services window, right click on ASP.NET State Service and select Start.
2. In web.config set sessionState mode="StateServer"
3. Set stateConnectionString="tcpip=StateServer:42424"
    Example: <sessionState mode="StateServer"     stateConnectionString="tcpip=localhost:42424"  

Advantages of using StateServer session state mode:
1. ASP.NET worker process independent. Survives worker process restart. 
2. Can be used with web farms and web gardens.
3. State server offers more scalability than InProc.

Dis-advantages of using StateServer session state mode:
1. StateServer is slower than InProc
2. Complex objects, need to be serialized and deserialized
3. If the StateServer, is on a dedicated machine, and if the server goes down all the sessions are lost.

Web Garden - Web application deployed on a server with multiple processors
Web Farm - Web application deployed on multiple server state server

No comments:

Post a Comment

If you like this website, please share with your friends on facebook and Google+ and recommend us on google using the g+1 button on the top right hand corner.