0

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.

jaxcoder
  • 31
  • 1
  • 8

1 Answers1

0

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:

http://azure.microsoft.com/blog/2014/10/30/azure-load-balancer-new-distribution-mode/

http://windowsitpro.com/azure/azure-load-balancer-stickiness-options

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

Bruno Faria
  • 3,814
  • 1
  • 13
  • 18
  • 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 07 '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 07 '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 07 '15 at 14:36
  • nop. very easy to use. Tutorial here for .net. They have sdk for node.js, php, python as well. https://azure.microsoft.com/pt-br/documentation/articles/cache-dotnet-how-to-use-azure-redis-cache/ – Bruno Faria Aug 07 '15 at 17:40
  • Awesome, thank you for all you time and assistance. – jaxcoder Aug 07 '15 at 18:08