Trying to programmatically shutdown a farm server in ARR throws "Query not supported" error

2

I'm trying to "Shutdown gracefuly" a sample server in a server farm using Microsoft.Web.Administration api. Found a similar solution on the internet, but it did not work for me.

        var mgr = new ServerManager();
        var conf = mgr.GetApplicationHostConfiguration();
        var sect = conf.GetSection("webFarms");
        var webFarms = sect.GetCollection();
        var farm = webFarms[0];
        var servers = farm.GetCollection();
        var server = servers[0];

        var arr = server.GetChildElement("applicationRequestRouting");

        var counters = arr.GetChildElement("counters");
        //Console.WriteLine(counters.Attributes); // This also gives error "not supported"

        var method = arr.Methods["SetState"];
        var instance = method.CreateInstance();
        instance.Input.Attributes[0].Value = 2; //shutdown gracefully
        instance.Execute(); // Exception from HRESULT: 0x80070032
c#
arr
remote-control
asked on Stack Overflow Oct 15, 2014 by John dow

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0