Enabling sticky sessions on a load balancer

后端 未结 2 1057
孤城傲影
孤城傲影 2020-12-15 14:12

Any advise on this one would be greatly appreciated, I\'ve been researching all morning and I\'m still scratching my head. I started at a new company a few weeks ago, where

相关标签:
2条回答
  • 2020-12-15 14:39

    zeencat, take a look at http://msdn.microsoft.com/en-us/library/ms178586.aspx at the State Server Mode section:

    StateServer mode stores session state in a process, referred to as the ASP.NET state service, that is separate from the ASP.NET worker process or IIS application pool. Using this mode ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm. To use StateServer mode, you must first be sure the ASP.NET state service is running on the server used for the session store. The ASP.NET state service is installed as a service when ASP.NET and the .NET Framework are installed.

    From what I understand the ASP.Net state service runs on one server, as a service called ASP.NET state service, both servers will have the same web.config file:

    <configuration>
      <system.web>
        <sessionState mode="StateServer"
          stateConnectionString="tcpip=SampleStateServer:42424"
          cookieless="false"
          timeout="20"/>
      </system.web>
    </configuration>
    

    This way, the session is stored on the server who hosts the service.

    Hope it helps, []

    0 讨论(0)
  • 2020-12-15 14:48

    Also look at using ElastiCache if you are in AWS or Redis if on premise as your ASP.NET session store instead of using sticky sessions. It has more advantages in terms of auto-scaling, load balancing and I would say performance. More info at http://blogs.msdn.com/b/webdev/archive/2014/05/12/announcing-asp-net-session-state-provider-for-redis-preview-release.aspx

    0 讨论(0)
提交回复
热议问题