locked
Regarding Web Farms RRS feed

  • Question

  • User-2061735273 posted

    We have hosted MVC4 web project into Web farm environment. But session value is becoming null or blank. I am using session state as "StateServer". In the both server am using same Machine Key and in service Asp State server is running also. Can anyone please help me out on this!!

    Thanks in advance!!

    Tuesday, September 12, 2017 5:11 AM

All replies

  • User-1838255255 posted

    Hi amogh1990,

    According to your description, as far as I know, you could refer to the following tutorials check how to share session in the web farms, please check:  

    Web farms in .NET and IIS part 5: Session state management:

    https://dotnetcodr.com/2013/07/01/web-farms-in-net-and-iis-part-5-session-state-management/

    Session-State Modes

    https://msdn.microsoft.com/en-us/library/ms178586.aspx 

    ASP.NET Session DataSet, DataTable, and .NET Class Storage<!--EndNoIndex-->:

    http://www.nullskull.com/a/1611/aspnet-session-dataset-datatable-and-net-class-storage.aspx 

    Best Regards,

    Eric Du

    Wednesday, September 13, 2017 5:33 AM
  • User-2061735273 posted

    Hi Eric Du,

    Thanks for the valuable reply.

    I have had referred above links. and configured my web.config like that only. But still problem exists. Session is becoming null or blank after login. So its again landing to login page. The same project works in single server environment. But the problem in F5 Load Balancer or Web farm environment.

    I have made web.config settings like below.

    1) Machine key is same in both server web.config:

    <machineKey decryptionKey="6A6D9C0D7FE77BEBC269B03CA2AD46B5D47A41832655DFA4,IsolateApps"
    validationKey="5BD312E9194C4CA805774C7582311F9B7C3D4C73D28431AB93B4D5085E06EE377165D8F13005257BB2FC5D8B093A65C282787672873A4AB1E6AD236A888F31DC,IsolateApps" />

    2) Using session state as Stateserver like below:

    <sessionState mode="StateServer"
      stateConnectionString="tcpip=127.0.0.1:42424"
      cookieless="false"
      timeout="20"/>

    3) AspState server is running in both the servers.

    4) Session objects are Serializable like below.

    [Serializable]
    [DataContract]
    public class CCredentialInfo : CClientCredentialInfo
    {

    [DataMember]
    public string UserName { get; set; }
    [DataMember]
    public string ClientIdentification { get; set; }
    [DataMember]
    public string ClientKey { get; set; }

    [DataMember]
    public int ClientId { get; set; }

    After making above settings also problem exists. If any changes need to be done please let me know.

    But i suspect some configuration setting is missing in F5 Load Balancer. Can any one help me out to configure F5 Load Balancer settings to manage session details?.

    Thanks in advance!!

    Wednesday, September 13, 2017 9:26 AM
  • User-1838255255 posted

    Hi amogh1990,

    According to your description, please check the following tutorials about how to configure the session:

    Load Balancing And Session State Configuration:

    http://www.c-sharpcorner.com/UploadFile/25c78a/load-balancing-session-state-configuration/ 

    Load Balancing Configuration-Manage Session State:  

    https://devnet.logianalytics.com/rdPage.aspx?rdReport=Article&dnDocID=2222#Session 

    Best Regards,

    Eric Du

    Saturday, September 16, 2017 8:58 AM