コード例 #1
0
        public override DeploymentResult VerifyCanRun()
        {
            var result = new DeploymentResult();

            if (Operation == Iis7Operation.Unspecified)
            {
                result.AddError("IIS7 Operation has not been specified.");
            }
            if (String.IsNullOrEmpty(ServerName))
            {
                result.AddError("IIS7 Server Name has not been specified.");
            }
            if (String.IsNullOrEmpty(ApplicationPool))
            {
                result.AddError("IIS7 Application Pool has not been specified.");
            }

            IisUtility.CheckForIis7(result);

            using (var iisManager = ServerManager.OpenRemote(ServerName))
            {
                CheckApplicationPoolExists(iisManager, result);
            }

            return(result);
        }
コード例 #2
0
 public static void StopAndWaitForCompletion(this ApplicationPool applicationPool)
 {
     applicationPool.Stop();
     do
     {
         IisUtility.WaitForIisToCompleteAnyOperations();
     } while (applicationPool.State == ObjectState.Starting);
 }
コード例 #3
0
        public override DeploymentResult VerifyCanRun()
        {
            var result = new DeploymentResult();

            IisUtility.CheckForIis7(result);

            var iisManager = ServerManager.OpenRemote(ServerName);

            CheckForSiteAndVDirExistance(DoesSiteExist, () => DoesVirtualDirectoryExist(GetSite(iisManager, WebsiteName)), result);

            if (UseClassicPipeline)
            {
                result.AddAlert("The Application Pool '{0}' will be set to Classic Pipeline Mode", AppPoolName);
            }


            ConfigureAuthentication(iisManager, result, false);

            return(result);
        }
コード例 #4
0
        //todo: there is quite a bit going on in here...this is going to need to be looked at...
        private void ExecuteOperation(ApplicationPool appPool, DeploymentResult result)
        {
            switch (Operation)
            {
            case Iis7Operation.StopApplicationPool:
                if (appPool == null)
                {
                    result.AddAlert(ApplicationPoolDoesNotExistError);
                }
                else if (appPool.CanBeStopped())
                {
                    CheckForElevatedPrivileges(appPool.StopAndWaitForCompletion);
                    result.AddGood("Application Pool '{0}' stopped.".FormatWith(ApplicationPool));
                }
                else
                {
                    result.AddNote("Application Pool '{0}' is not running.".FormatWith(ApplicationPool));
                }
                break;

            case Iis7Operation.StartApplicationPool:
                if (appPool == null)
                {
                    throw new InvalidOperationException(ApplicationPoolDoesNotExistError);
                }
                else if (appPool.CanBeStarted())
                {
                    IisUtility.WaitForIisToCompleteAnyOperations();
                    CheckForElevatedPrivileges(appPool.StartAndWaitForCompletion);
                    result.AddGood("Application Pool '{0}' started.".FormatWith(ApplicationPool));
                }
                else
                {
                    result.AddGood("Application Pool '{0}' is already running.".FormatWith(ApplicationPool));
                }
                break;
            }
        }