Question

I've been busy with this for months now.

I currently have 2 servers for 1 website. Using round robin dns I find that in the beginning everything works (checking the ip of the website it changed but I can go on with my session), but after a while I lose my session, seems like the formsauthentication cookie cannot be read and is being discarded. (assumption) But this does not happen all the time. Only sometimes.

I'm using iis7 shared configuration, I set the machine key and I'm using stateserver pointing to one of the servers and I verified that on both servers the stateserver works.

I read something about the IIS application path, but I don't really know what is meant by that, is it the path of the webapp, or the path where IIS is installed? In both cases they are the same.

Anyone have some ideas?

Was it helpful?

Solution

I'll answer this one myself, for anyone facing the same problem. Everything was set up correct but the machine key should be located in the web.config under system.web. Generating the key via iis 7 didn't work for some reason, I generated it with an online tool: http://aspnetresources.com/tools/machineKey

So, to do load balancing and set up multiple servers on iis7 you should:

  • Use a stateserver out-proc (stateserver or sql server) and have all servers point to that stateserver (example: stateConnectionString="tcpip=server1:42424")
  • Use iis shared configuration so all your servers point to a share where the applicationhost.config resides.
  • Generate a machine key (not via iis, just use an online tool!)
  • Set up NLB (or round robin DNS) and test it by flushing your dns on your client when you're logged in and see if your session doesn't get lost.

Hope this helps someone.

OTHER TIPS

And the machine keys are specific to the .NET version. To check your current version: In the IIS console, at the server level, click "Change .NET Framework Version" in the Actions pane.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top