Solved

Sessioning problem with load balancing

Posted on 2004-08-19
5
1,373 Views
Last Modified: 2011-10-03
Hi,
I have two web servers running under a load balancer. They are Windows 2003 servers, run IIS 6.0, and host ASPX pages (.NET version 1.1). My problem is that whenever the load balancer switches from server A to B or vice versa, a new session is created and the Session_Start method fires. This results in the existing session data being lost. Both servers have SQLSessioning enabled, and have the same web.config & machine.config files.

Can somebody help me out in solving this problem?

Thanks,
Karun.
0
Comment
Question by:KarunSK
5 Comments
 
LVL 34

Expert Comment

by:Dave_Dietz
Comment Utility
What are you using to load balance the servers?

The behavior you describe is exaclty as expected if you don't have some sort of affinity set for sessions.  In WLBS you would set the Affinity.  Some other hardware balancers use different terms for roughly the same meaning (Cisco uses the term Sticky if I remember correctly).  Any decent load balancing technology should be able to handle this since SSL will also break if you switch endpoints in the middle of a session.

Dave Dietz
0
 
LVL 4

Expert Comment

by:philippe_leybaert
Comment Utility
You should store session state on one of the 2 servers (or a seperate server), and change your session management in web.config to use the session state server like this:

<sessionState mode="StateServer"
  stateConnectionString="tcpip=MYSTATESERVER:42424" />

This way, all your load balanced servers will use the same session database, stored at "MYSTATESERVER". Just make sure the "ASP.NET State Service" is running on "MYSTATESERVER"
0
 
LVL 6

Author Comment

by:KarunSK
Comment Utility
Thanks for the replies. I have SQLSessioning enabled. The web.config entry is something like this:

<sessionState mode="SQLServer" sqlConnectionString="Server=[servername];UID=[user];PWD=[password]" cookieless="false" timeout="720"/>

Since the same web.config is present in both servers, they both hit the same SQL server for sessioning.

Any more ideas?

Thanks a lot,
Karun.
0
 
LVL 6

Author Comment

by:KarunSK
Comment Utility
Hi,

I got the solution! This problem arose because the web site ID on both the web servers was different. Once I edited the IIS metadata (an XML file under c:\windows\system32\inetsrv for IIS 6.0) and changed the web site ID so that the numbers matched on both web servers, I no more encountered this problem.
0
 

Accepted Solution

by:
RomMod earned 0 total points
Comment Utility
The question has been PAQ'd and the 500 points have been refunded.
RomMod
Community Support Moderator
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Here are the symptoms: You start receiving calls from users that one of your legacy web apps isn't coming up, so you log into your IIS 5 server to check it out.  When you pull up the services, you notice that the WWW Publishing service isn't runn…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now