We have a web application that is hosted in Microsoft Azure Cloud Services. We have multiple instances in each environment, and all is well.
I am in the process of moving this application from Cloud Services into Azure VMs. The application is load balanced across multiple VM instances.
I have a weird problem that I have never encountered before: basically- I can only log into one instance at a time.
For example, if I log into my application on one instance, and then navigate to the other instance, then I will not be logged in. Yet if I navigate back to the first instance then I will be logged in. Additionally- If i then navigate to the second instance (the one where I am not logged into), and then log in, then I will be logged into the second instance, but will get logged out of the first instance.
I have a machine key defined in my web.config.
I am using a distributed session provider (Redis).
My problem is similar to this on: asp.net forms authentication logged out when logged into another instance (in the sense that the symptoms are the same), but because this is a multi instance site, I am actually using the same domain to access the instances, and so the answer supplied in this question is not relevant.
Here is a screenshot of each instance and their cookies:
(I've accidentally trimmed the SessionID from the logged in image, but they are they same on both instances)
I'm completely stumped. Has anyone got any ideas?
Boy do I feel dumb. Turns out I had a config transform that was changing the Machine key values to AutoGenerate
.
We use Octopus Deploy, and so rarely use transform files. I think this is what caught me out.