private void StartSite(ServerManager iisManager, string siteName)
        {
            Site site = iisManager.Sites[siteName];

            if (site == null)
            {
                return;
            }

            switch (site.State)
            {
            case ObjectState.Started:
                return;

            case ObjectState.Starting:
                break;

            case ObjectState.Stopped:
                site.Start();
                break;

            case ObjectState.Stopping:
                ThreadService.SleepUntil(() => site.State == ObjectState.Stopped, 3);
                site.Start();
                break;
            }

            ThreadService.SleepUntil(() => site.State == ObjectState.Started, 3);

            List <string> appPoolNames = site.Applications.Select(app => app.ApplicationPoolName).Distinct().ToList();

            foreach (string appPoolName in appPoolNames)
            {
                ApplicationPool applicationPool = iisManager.ApplicationPools[appPoolName];

                switch (applicationPool.State)
                {
                case ObjectState.Started:
                    return;

                case ObjectState.Starting:
                    break;

                case ObjectState.Stopped:
                    applicationPool.Start();
                    break;

                case ObjectState.Stopping:
                    ThreadService.SleepUntil(() => applicationPool.State == ObjectState.Stopped, 3);
                    applicationPool.Start();
                    break;
                }
            }

            ThreadService.SleepUntil(() => appPoolNames.All(a => iisManager.ApplicationPools[a].State == ObjectState.Started), 3);
        }