azure - How can I use start script change IIS Application pool pipeline mode -


i used web role. wonder if can use start script project change pipeline mode classic.

i can use c# code achieve that, prefer use cmd, problem meet here how can applicationpool name cmd? here c# code:

    {         using (servermanager servermanager = new servermanager())         {             site site = servermanager.sites[roleenvironment.currentroleinstance.id + "_web"];                  configuration config = servermanager.getapplicationhostconfiguration();                 string apppoolname = site.applications[0].applicationpoolname;                  configurationsection applicationpoolssection = config.getsection("system.applicationhost/applicationpools");                  configurationelementcollection applicationpoolscollection = applicationpoolssection.getcollection();                  configurationelement addelement = findelement(applicationpoolscollection, "add", "name", apppoolname);                 if (addelement == null) throw new invalidoperationexception("element not found!");                  addelement["managedpipelinemode"] = @"classic";                  servermanager.commitchanges();                return base.onstart();         }     }      private static configurationelement findelement(configurationelementcollection collection, string elementtagname, params string[] keyvalues)     {         foreach (configurationelement element in collection)         {             if (string.equals(element.elementtagname, elementtagname, stringcomparison.ordinalignorecase))             {                 bool matches = true;                  (int = 0; < keyvalues.length; += 2)                 {                     object o = element.getattributevalue(keyvalues[i]);                     string value = null;                     if (o != null)                     {                         value = o.tostring();                     }                      if (!string.equals(value, keyvalues[i + 1], stringcomparison.ordinalignorecase))                     {                         matches = false;                         break;                     }                 }                 if (matches)                 {                     return element;                 }             }         }         return null;     }  } 

so how can ?

if pool name problem facing, try using appcmd listing available pools:

appcmd.exe list apppool /text:* 

this should give apppools available on iis app names (provided have enough rights).


Comments