ASP.NET State database and Load Balancers RRS feed

  • Question

  • User-1690212949 posted


    I have a web site that is installed on two servers that is connected to a load balancer.  I have added the following to the web.config file to enable the ASP.NET session state database on the two servers:  (I'm have used the following page as a guide: https://support.microsoft.com/en-us/kb/323262)

          <sessionState mode="SQLServer" 
            sqlConnectionString="data source= ServerName;
            user id=User;password=Password" 
            timeout="20" /> 

    During testing, I'm noticing that I'm getting a new entry in the ASP session state database, which is good, but there is one thing I'm wondering about.  When you have the ASP.NET Session State database setup in a load balanced environment, wouldn't that grant the ability to seamlessly switch to the second server under the load balancer when the first server happens to go down?

    Monday, April 13, 2015 3:48 PM


  • User1104055534 posted

    Hi CCGPlayer,

    The answer is yes, sql server will hold all session data in its table and web servers will acquire these data from the same sql server.

    Sql Server is the most reliable option for session state, can be used with web farms and web gardens and more scalable than state server and InProc session state modes.

    Also you should to know that Sql server state mode would be slower than State Server and InProc Session state modes and complex objects need to be serialized and deserialized.

    Consider about cloud for today, you may want to know there is another option for this requirement, please refer to the following link for detailed information:

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 22, 2015 6:55 AM