Losing session data when switching web servers on Azure web farm with 2 web servers. How can I share the keys with each server?

Our websites were working flawlessly to be exaggerative when they were running on Rackspace. We have since moved to Azure and we are experiencing all kinds of session issues. I believe this is due to Rackspace being configured for Sticky Sessions and Azure not supporting them.

Am I on the right track? And if so, what is a solution for this; - Long Term - Short Term - Immediate

Current Setup Info: InProc session control in web.config on both servers IIS 8 Windows Server 2012 R2 VM's for each webserver (WEB1 & WEB2)

Any further information will be greatly appreciated.


You just have to change the load balance distribution mode of your cloud service to Source IP (aka stick sessions). You have to use powershell:

Set-AzureLoadBalancedEndpoint -ServiceName "MyService" -LBSetName "LBSet1" -Protocol tcp -LocalPort 80 -ProbeProtocolTCP -ProbePort 8080 –LoadBalancerDistribution "sourceIP"

Detailed references:




  • Thanks for your comment. I have utilized the links and put together some options for our team to consider for our solution. Our three options are: 1. Use SQL Server for session state 2. Use Azure Key Vault 3. Configuration of Azure Load Balancer(need to research further, I have heard that this is not supported by Azure to use 'stickey sessions'. – JaxCoder Aug 7 '15 at 13:26
  • The configuration i gave you is sticky session. It's supported since Oct' 14. Once a user connects to a server they will stay on this server until their connection is disconnected or idle for the amount of time you specified in the endpoint (adjust IdleTimeoutInMinutes according to your desired session timeout). No need to change your application. Anyway, your team should consider an external plataform for user session tho as best practice. I recommend Redis over sql server because of it's builtin document expiration functionality. No need to implement your own mechanism of expiring sessions. – Bruno Faria Aug 7 '15 at 14:17
  • I was looking into Redis as a primary recommendation. I saw the module in the Azure Portal. Is the implementation very difficult? – JaxCoder Aug 7 '15 at 14:36
  • nop. very easy to use. Tutorial here for .net. They have sdk for node.js, php, python as well. azure.microsoft.com/pt-br/documentation/articles/… – Bruno Faria Aug 7 '15 at 17:40
  • Awesome, thank you for all you time and assistance. – JaxCoder Aug 7 '15 at 18:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.