We setup our IIS sites to accommodate blue / green deployments. We noticed that after reboot the wrong sites get started.
The setup:
app.blue
app.green
app.entry
On the app.entry
site we have a rewrite rule that forwards traffic to either the app.blue
or app.green
depending on which is the active site. This all works as expected and has for quite some time.
Recently, because of Windows Updates the server has rebooted during non-production hours. After the reboot we noticed the wrong IIS sites are getting started. So, for example app.blue was the active site and the rewrite rule is pointing to app.blue
on the app.entry
rule. After the reboot, app.green
is started, but obviously the entry rule is pointing to blue.
We are using the IIS Admin API to manage the site swaps and updating the rewrite rule. What seems to be strange is the sites that get started were set as the previous Blue / Green site. In the example above, app.green
was the previous site so after reboot it gets restarted and the app.blue
was stopped.
The only option I can think of to correct this is to has a task run after reboot to check the rewrite rules and start / stop the correct sites.