Solved

Sessioning problem with load balancing

Posted on 2004-08-19
5
1,375 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
ID: 11849246
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
ID: 11851685
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
ID: 11852664
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
ID: 11905219
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
ID: 11909966
The question has been PAQ'd and the 500 points have been refunded.
RomMod
Community Support Moderator
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I came across an interesting issue that had me pulling my hair out.  I was troubleshooting a new internal web site which uses integrated security instead of anonymous.  When browsing the site from my laptop, I was able to access it with no iss…
First of all, clustering IIS is something you should rarely consider doing. In almost all cases, Microsoft Network Load Balancing (NLB) (http://technet.microsoft.com/en-us/library/cc758834(WS.10).aspx) is a much better solution when you need to p…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

776 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