473,405 Members | 2,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Session state with load balancing

In Web.config file is a setting for sessionState. If I
want to maintain a users' session state (ie use the
Session object) in a web farm that is being load balanced
by a Cisco CSS 11501 Switch. How do I setup sessionState
so anything saved to the Session object stays with that
session no matter what web server they get bounced around
to?
Nov 18 '05 #1
1 4296
Robert

I think what you really want to do is provide Session state that supports load balancing. This is better than trying to maintain server-adherence since that sort of defeats the purpose of load balancing

There are two ways to do this, one is to use a "StateServer" service. This is very easy to do, just pick a machine to be your state server and point all the machines on your farm to that server in the session cofniguration

The other way is to use SQLServer session state. This stores all of the state information in a SQL server of your choosing. This is my personal preference because our SQL Servers have a fail over strategy that will ensure that the farm is never down, where if yo use the state server method you are relying on a single machine being up and running, and if it goes down your farm dies

There are a couple things you will want to pay careful attention to when setting up farm session state

1. Make sure you have the same MachineKey configured in your machine.config file on all machines on the farm. The reason for this is that the view state (stored on the client) is encrypted using the machine key of the server that served the page. If you bounce between two or machines within a single session you will get an error that you have an invalid view state

2. Double check all of your application config files. By default, Visual Studio.NET will create a web.config for each ASP.NET project you create. The settings in this file default to InProcess session state. This will cause problems because this setting will override the setting in your machine.config and you will be ripping your hair out. The easiest thing to do is to just delete the web.config file entirely if you are not using it, or if you are using it, delete the Session configuration block from it so that your web application uses the default you conifugred in the machine.config

I hope this helps, if you need more help or examples, just let me know

Thanks
-Cla

Clayton Gulick, MCSD
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Max | last post by:
Frankly, i need session variables to persist regardless of load balancing. My hoster says save them in files, yuk. Are there any other thoughts The problem is that the session variables are lost...
0
by: Nikander Bruggeman | last post by:
Hi, In a situation where I have 2 servers which are load balanced I keep losing session state, although I store the session state in sql server and use a cookieless session, so that the session...
3
by: Nhi Lam | last post by:
Hi, I understand that there are 3 modes in which I can configure the SessionStateModule. What I need is an out of process Session State store with fail over support. The "SQL Server Mode" seems...
4
by: DeeAnn | last post by:
We've encountered a "flaky" situation with a Session variable holding a data set on load balanced servers; server session with cookies is set up. Background: Session variable holds a dataset. ...
31
by: Harry Simpson | last post by:
I've come from the old ASP camp where session variables were not used. When i started using ASP.NET in 2001, I started using them again because it was ok from what I'd read. I've been merrily...
6
by: Andrew Robinson | last post by:
I am running two servers with a hardware network load balancing device. I know that to share session information between the two servers I need to implement some type of SQL based session...
1
by: Vidyadhar Joshi | last post by:
I have the following scenario in a true load balanced environment (without sticky sessions): There are 2 ASPX pages. I want to pass an object from the first page to the second page. On the...
1
by: m.a | last post by:
Hello, I am looking for a hosting solution for my asp.net application. I found that some ISP stated that session states are not preserved in a load balancing system. As I know, if the asp.net is...
6
by: =?Utf-8?B?QnJlbmRhbiBLYXk=?= | last post by:
Hi there, We have an ASP.Net application that is generating huge numbers of Context Switches when a certain number of active users are present. We tried changing the configuration of the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.