问题
I am using Azure Traffic manager to load balance two servers in different regions. I thought I would need a single store or redis cache for my session state. However, while testing it seems to keep me logged in even when I go back between servers by testing which server I am on. I log out, and I am logged out on the other. The only session state I am storing is a user profile, but if it's not found it just goes to the server and grabs it. Below is my forms setup. Do I really need something like redis cache?
<sessionState timeout="2880" mode="InProc" />
<authentication mode="Forms">
<forms loginUrl="/login" path="/" protection="All" domain=".example.com" timeout="2880" slidingExpiration="true" name="_EXPOSURE_" />
</authentication>
回答1:
Only you can decide how to design your app, but... Traffic Manager has nothing to do with session state at all. It just routes your user traffic to multiple web endpoints based on routing method chosen (distance / round robin / primary+failover).
Your session state snippet above represents InProc, which means that session data is maintained inside your web server on a given VM. It is not shared outside of the VM. If you want session state shared across multiple VMs (or web apps), you must store your session state external to the web server.
Whether you use Redis, or SQL Database, or something else, is up to you.
来源:https://stackoverflow.com/questions/36487792/load-balancing-with-azure-traffic-manager-and-session-state-store-necessary