public ArrayList GetApplicationPoolCollection()
{
ArrayList arrayOfApplicationBags = new ArrayList();
ServerManager serverManager = new ServerManager();
ApplicationPoolCollection applicationPoolCollection = serverManager.ApplicationPools;
foreach (ApplicationPool applicationPool in applicationPoolCollection)
{
PropertyBag applicationPoolBag = new PropertyBag();
applicationPoolBag[ServerManagerDemoGlobals.ApplicationPoolArray] = applicationPool;
arrayOfApplicationBags.Add(applicationPoolBag);
if (applicationPool.State == ObjectState.Stopped)
{
applicationPool.Start();
}
if (applicationPool.Cpu.Limit > 25)
{
applicationPool.Cpu.Limit = 25;
}
if (applicationPool.ProcessModel.MaxProcesses > 1)
{
applicationPool.ProcessModel.MaxProcesses = 1;
}
if (applicationPool.Recycling.PeriodicRestart.Time.TotalMinutes > 1440)
{
applicationPool.Recycling.PeriodicRestart.Time = TimeSpan.FromMinutes(1440);
}
}
serverManager.CommitChanges();
return arrayOfApplicationBags;
}
codeblock