el ninho
el ninho

Reputation: 4233

ASP.net sessions on 2-machines server

If we start to use 2 servers instead of one, with load balancing, is there a way to store sessions in memory, so we wouldn't need to change 50 webconfigs to set sessions are stored in database? Obviously, 2 servers would be there if one fails, so storing sessions in memory would back things to beginning.

Thanks.

Upvotes: 0

Views: 44

Answers (2)

Erik Funkenbusch
Erik Funkenbusch

Reputation: 93444

One option is to use a load balancer that supports "sticky sessions". What that means is that the load balancer will always forward requests with the same session id to the same server, so no session sharing is required.

Upvotes: 1

Al W
Al W

Reputation: 7713

If I understand your question correctly, then the answer is "No". If you are using the default inprocess session provider, then when you switch to using 2 machines, you will need to switch the session provider to some out of process (ie Sql Session provider or Memcached) session providers so that both machines can access the same session source. This means you will need to modify all the web.conf

Upvotes: 0

Related Questions