How do I automate maintenance in my IIS web app with Powershell?
Posted on 2015-01-08
I just wondering how to figure out with a solution that allows an application to signal to our load balancer that it is no longer part of a load balance pool...
I imagine to place a sort of empty "flag" file named "ExposeToLoadBalancer.flag" into the web application folder that will cause a particular URL within the application (that the loadbalancer monitors) to return a "200 OK" status code - and the load balancer will send http requests to the application.
Instead, if the file does not exist, then the application will respond with "503 Under Maintenance", and this will cause the loadbalancer to no longer send new requests to the application.
This is the idea to automate the process.....but I'm not sure if it may be correct!
I'd like some help in order to create a script that can add the "ExposeToLoadBalancer.flag" to each application directory and one that will remove it.
Once a web application has been hidden from the loadbalancer, it can be stopped.
I assume to wait 30 seconds between "hiding" and stopping - just to allow any "in-flight" requests to complete.
Unluckly I'm not very confident with PS using IIS....could someone give me a hint?
Thanks in advance!