コード例 #1
0
        public override bool Execute(out string message)
        {
            bool result = false;

            result = IISHelper.RestartIIS(this.ServerName, out message);
            return(result);
        }
コード例 #2
0
 public RecycleApplicationPool(string serverName, string applicationPool)
     : base()
 {
     this.ServerName                = serverName;
     this.ApplicationPool           = applicationPool;
     this.IsApplicationPoolExisting = IISHelper.DoesApplicationPoolExists(this.ServerName, this.ApplicationPool);
 }
コード例 #3
0
        private void tabPage1_Enter(object sender, EventArgs e)
        {
            treeView1.Nodes.Clear();
            webApplicationStatusactionsList = new List <BaseAction>();
            TreeNode applicationNode = treeView1.Nodes.Add(this.applicationName);

            applicationNode.ImageIndex         = 0;
            applicationNode.SelectedImageIndex = 0;
            applicationNode.ContextMenuStrip   = contextMenuStripRefreshWebApplicationStatus;
            foreach (var server in serverList)
            {
                string appPoolName = "";
                foreach (var item in IISHelper.GetSvcOrAsmxName(server, this.applicationName, out appPoolName))
                {
                    UriBuilder uriBuilder = new UriBuilder();
                    uriBuilder.Host = server;
                    uriBuilder.Path = string.Format(@"{0}\{1}", this.applicationName, item);
                    TreeNode webApp = applicationNode.Nodes.Add(uriBuilder.ToString());
                    webApp.ContextMenuStrip = contextMenuStripWebApp;
                    CheckWebServiceStatusAction chk = new CheckWebServiceStatusAction(uriBuilder.ToString());
                    webApp.Tag = chk;
                    webApplicationStatusactionsList.Add((BaseAction)chk);
                }
            }
            BeginCheckingWebServiceStatus(webApplicationStatusactionsList);
            treeView1.ExpandAll();
        }
コード例 #4
0
        public AstoriaServiceHost(Workspace workspace, string webDataServicePrefixName, string machineName, AstoriaDatabase database)
            : base(workspace, webDataServicePrefixName, machineName, database)
        {
            if (AstoriaTestProperties.Host == Host.IDSH || AstoriaTestProperties.Host == Host.IDSH2)
            {
                if (AstoriaTestProperties.HostAuthenicationMethod != "None")
                {
                    AstoriaTestLog.FailAndThrow("Test implementations of IDSH do not support authentication");
                }
            }

            waitHandleName      = waitHandlePrefix + identifier;
            serviceInstanceName = this.WebDataServicePrefixName + "_" + identifier;
            exeName             = serviceName + this.WebDataServicePrefixName;

            if (ProcessHelper.IsLocalMachine(this.MachineName))
            {
                DestinationFolder       = Path.Combine(serviceHostFolder, serviceInstanceName);
                DestinationFolder_Local = DestinationFolder;
                ExecutablePath          = Path.Combine(DestinationFolder, exeName + ".exe");
                localExecutablePath     = ExecutablePath;
            }
            else
            {
                string remoteMachineLocalPath = IISHelper.GetLocalMachineWWWRootSharePath(this.MachineName);
                DestinationFolder_Local = Path.Combine(IISHelper.GetLocalMachineWWWRootSharePath(this.MachineName), serviceInstanceName);
                DestinationFolder       = Path.Combine(IISHelper.GetWWWRootSharePath(this.MachineName), serviceInstanceName);
                ExecutablePath          = Path.Combine(DestinationFolder, exeName + ".exe");
                localExecutablePath     = Path.Combine(DestinationFolder_Local, exeName + ".exe");
            }

            rootUri = Uri.UriSchemeHttp + "://" + this.MachineName + ":7777";
        }
コード例 #5
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         IISHelper.CleanupIIS(this.options);
     }
 }
コード例 #6
0
ファイル: WebInstaller.cs プロジェクト: vaginessa/myrtille
        private void DoUninstall()
        {
            // enable the line below to debug this installer; disable otherwise
            //MessageBox.Show("Attach the .NET debugger to the 'MSI Debug' msiexec.exe process now for debug. Click OK when ready...", "MSI Debug");

            Trace.TraceInformation("Uninstalling Myrtille.Web");

            try
            {
                // unregister Myrtille.Web from local IIS

                if (IISHelper.IsIISApplicationExists("/Myrtille"))
                {
                    IISHelper.DeleteIISApplication("/Myrtille");
                }

                if (IISHelper.IsIISApplicationPoolExists("MyrtilleAppPool"))
                {
                    IISHelper.DeleteIISApplicationPool("MyrtilleAppPool");
                }

                // delete myrtille user

                AccountHelper.DeleteLocalUser("Myrtille");

                Trace.TraceInformation("Uninstalled Myrtille.Web");
            }
            catch (Exception exc)
            {
                Context.LogMessage(exc.InnerException != null ? exc.InnerException.Message : exc.Message);
                Trace.TraceError("Failed to uninstall Myrtille.Web ({0})", exc);
                throw;
            }
        }
コード例 #7
0
ファイル: IISSiteTests.cs プロジェクト: zjj10330/win-acme
 public IISSiteTests()
 {
     log             = new Mock.Services.LogService(false);
     iis             = new Mock.Clients.MockIISClient(log);
     helper          = new IISHelper(log, iis);
     plugins         = new MockPluginService(log);
     userRoleService = new Mock.Services.UserRoleService();
 }
コード例 #8
0
        /// <summary>
        /// 回收IIS应用程序池
        /// </summary>
        /// <param name="projectAction"></param>
        /// <param name="iisVersion"></param>
        private void RecycleIISPool(DepProjectAction projectAction, IIsVersion iisVersion)
        {
            DepProjectItem projectItem = SvnProcesser.ProjectItem(projectAction.DepId);
            string         strOutput;

            IISHelper.GetIIS(iisVersion, projectItem.WebSite).RecycleAppPool(out strOutput);
            SvnProcesser.UpdateDeployStatus(projectAction.Id, SUCCESS, strOutput);
        }
コード例 #9
0
 public static IController GetController()
 {
     if (IISHelper.IsIIS7AndHigher())
     {
         return(new IIS7Controller());
     }
     return(new IIS6Controller());
 }
コード例 #10
0
 public IISBindingTests()
 {
     log             = new Mock.Services.LogService(false);
     iis             = new Mock.Clients.MockIISClient(log);
     helper          = new IISHelper(log, iis);
     version         = new VersionService(log);
     plugins         = new MockPluginService(log, version);
     userRoleService = new Mock.Services.UserRoleService();
 }
コード例 #11
0
        public override bool Execute(out string message)
        {
            bool   result = false;
            string exceptionMessage;

            result  = IISHelper.DeleteApplication(this.ServerName, this.AppName, this.SiteName, out exceptionMessage);
            message = exceptionMessage;
            return(result);
        }
コード例 #12
0
        public virtual ActionResult Publish(string siteName)
        {
            if (string.IsNullOrWhiteSpace(siteName))
            {
                throw new ArgumentNullException("siteName");
            }

            var site = SiteHelper.Parse(siteName);

            if (site == null)
            {
                throw new NullReferenceException("site");
            }
            site = site.AsActual();
            var rootSite = SiteHelper.GetRootSite(site).AsActual();

            if (string.IsNullOrWhiteSpace(rootSite.ClientId))
            {
                throw new Exception("Customer ID is not specified".Localize());
            }

            var ip          = rootSite.FrontendDefaultIp;
            var path        = Path.Combine(site.PhysicalPath, rootSite.FrontendPhysicalPath);
            var protocol    = rootSite.FrontendDefaultProtocol;
            var port        = rootSite.FrontendDefaultPort;
            var appPoolName = rootSite.FrontendDefaultApplicationPoolName;
            var name        = site.UID; //string.Format("Frontend.{0}.{1}", rootSite.ClientId, siteName);

            //Chek domain name
            //
            if (site.Domains == null || site.Domains.Length == 0)
            {
                var result = new JsonResultData(ModelState);
                result.AddErrorMessage("Before publish site you must specify the domain name (System/Settings/Domain/Domains)".Localize());
                return(Json(result));
            }

            try
            {
                //Create web site
                //
                IISHelper.CreateWebSite(appPoolName, name, protocol, ip, site.Domains.ToArray(), port, path);
            }
            catch (Exception e)
            {
                var result = new JsonResultData();
                result.AddException(new Exception("Fail to publication.".Localize() + " " + e.Message, e));
                return(Json(result));
            }

            //Result
            //
            var data = new JsonResultData(ModelState);

            data.ReloadPage = true;
            return(Json(data));
        }
コード例 #13
0
        public override bool Execute(out string message)
        {
            bool   result = false;
            string exceptionMessage;

            result  = IISHelper.CheckWebServiceStatus(this.Uri, out exceptionMessage);
            message = exceptionMessage;
            return(result);
        }
コード例 #14
0
 public IIS(
     ILogService logService, IUserRoleService roleService,
     IISHelper helper, IISOptions options)
 {
     _log             = logService;
     _options         = options;
     _helper          = helper;
     _userRoleService = roleService;
 }
コード例 #15
0
ファイル: IISSitesTests.cs プロジェクト: usshen/win-acme
 public IISSitesTests()
 {
     log             = new mock.LogService(false);
     iis             = new Mock.Clients.MockIISClient(log);
     helper          = new IISHelper(log, iis);
     version         = new VersionService(log);
     plugins         = new mock.MockPluginService(log, version);
     userRoleService = new UserRoleService(iis);
 }
コード例 #16
0
        public override bool Execute(out string message)
        {
            bool   result = false;
            string exceptionMessage;

            CreatePhysicalPathIfNotExisting(this.ServerName, this.PhysicalPath);
            result  = IISHelper.CreateApplication(this.ServerName, this.AppName, this.PhysicalPath, this.AppPoolName, this.SiteName, out exceptionMessage);
            message = result ? "App created successfully." : exceptionMessage;
            return(result);
        }
コード例 #17
0
 private void LoadTabPage2()
 {
     comboBoxWebSites.Items.Clear();
     comboBoxAppPools.Items.Clear();
     comboBoxWebSites.Items.Add(this.websiteName);
     comboBoxAppPools.Items.AddRange(IISHelper.GetAppPools().ToArray());
     comboBoxWebSites.Text = comboBoxWebSites.Items[0].ToString();
     comboBoxAppPools.Text = comboBoxAppPools.Items[0].ToString();
     LoadListViewCreateApp();
 }
コード例 #18
0
        public override bool Execute(out string message)
        {
            bool   result = false;
            string exceptionMessage;

            result = IISHelper.CreateAppPool(this.ServerName, this.AppPoolName, this.AppPoolCLRVersion, this.AppPoolPipelineMode, this.Enable32Bit,
                                             this.IdentityType, this.AppPoolUserName, this.AppPoolPassword, out exceptionMessage);
            message = result ? "App pool created successfully." : exceptionMessage;
            return(result);
        }
コード例 #19
0
        public override void Stop()
        {
            logger("Start to IIS WebsiteStop :" + this.args.SiteName);
            if (IISHelper.IsWebsiteStop(this.args.SiteName))
            {
                logger("Success to IIS WebsiteStop :" + this.args.SiteName);
            }
            else
            {
                var retryStopWebSite = 0;
ReTryStopWebSiet:
                retryStopWebSite++;
                var siteResult = IISHelper.WebsiteStop(this.args.SiteName);
                if (!string.IsNullOrEmpty(siteResult))
                {
                    if (retryStopWebSite >= 3)
                    {
                        logger($"File to IIS WebsiteStop :{this.args.SiteName},Err:{siteResult}, Retry limit.");
                        return;
                    }

                    logger($"File to IIS WebsiteStop :{this.args.SiteName},Err:{siteResult}, wait 5seconds and Retry : " + retryStopWebSite);
                    Thread.Sleep(5000);
                    goto ReTryStopWebSiet;
                }
            }



            if (!IISHelper.IsApplicationPoolStop(this.args.ApplicationPoolName))
            {
                var retryStopPool = 0;
ReTryStopPool:
                retryStopPool++;

                var stopPoolResult = IISHelper.ApplicationPoolStop(this.args.ApplicationPoolName);
                if (!string.IsNullOrEmpty(stopPoolResult))
                {
                    if (retryStopPool >= 3)
                    {
                        logger($"File to Stop IIS ApplicationPool :{this.args.ApplicationPoolName },Err:{stopPoolResult},  Retry limit.");
                        return;
                    }

                    logger($"File to Stop IIS ApplicationPool :{this.args.ApplicationPoolName },Err:{stopPoolResult}, wait 5seconds and Retry : " + retryStopPool);
                    Thread.Sleep(5000);
                    goto ReTryStopPool;
                }
            }


            logger("wait for IIS WebsiteStop 5sencods :" + this.args.SiteName);
            Thread.Sleep(5000);
            logger("Success to IIS WebsiteStop :" + this.args.SiteName);
        }
コード例 #20
0
        public JsonResult AppPoolRecycle()
        {
            var is_ok = IISHelper.AppPool(IISHelperAppPoolMethod.Recycle, WebSite.AppPoolName);

            if (is_ok)
            {
                AddAdminLogs(Entity.SysLogMethodType.Resotre, "回收应用程序池");
                WorkContext.AjaxStringEntity.msg = 1;
            }
            return(Json(WorkContext.AjaxStringEntity));
        }
コード例 #21
0
 public IISOptionsFactory(
     ILogService log,
     IISHelper iisHelper,
     IArgumentsService arguments,
     IUserRoleService userRoleService)
 {
     _iisHelper = iisHelper;
     _log = log;
     _arguments = arguments;
     Disabled = IIS.Disabled(userRoleService);
 }
コード例 #22
0
ファイル: IISSitesTests.cs プロジェクト: digicert/win-acme
        public IISSitesTests()
        {
            log = new mock.LogService(false);
            iis = new Mock.Clients.MockIISClient(log);
            var settings = new mock.MockSettingsService();
            var proxy    = new mock.ProxyService();

            domainParse     = new DomainParseService(log, proxy, settings);
            helper          = new IISHelper(log, iis, domainParse);
            plugins         = new mock.MockPluginService(log);
            userRoleService = new UserRoleService(iis);
        }
コード例 #23
0
        private void restartAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            DialogResult res = System.Windows.Forms.DialogResult.Retry;

            while (res == System.Windows.Forms.DialogResult.Retry)
            {
                string result = IISHelper.RestartIIS();
                res = AbortRetryIgnoreAction(result, "All servers collectively.");
            }
            this.Cursor = Cursors.Default;
        }
コード例 #24
0
        public void RecycleApplicationPool(string poolName)
        {
            /*
             * for this to work, the myrtille services need to run on the same machine as the myrtille gateway
             * the myrtille gateway can't recycle its own application pool because it doesn't have enough privileges
             * the recycling action creates a new w3wp.exe process, running under the pool identity
             * the old (recycled) w3wp.exe process remains alive as long as there is an ongoing http request to the application (graceful exit)
             * when it's over, the old process is stopped, all its allocated resources are returned to the operating system and the new process takes over
             */

            IISHelper.RecycleIISApplicationPool(poolName);
        }
コード例 #25
0
ファイル: WebInstaller.cs プロジェクト: yusufozturk/myrtille
        private void DoUninstall()
        {
            // enable the line below to debug this installer; disable otherwise
            //MessageBox.Show("Attach the .NET debugger to the 'MSI Debug' msiexec.exe process now for debug. Click OK when ready...", "MSI Debug");

            Trace.TraceInformation("Uninstalling Myrtille.Web");

            try
            {
                // unregister Myrtille.Web from local IIS
                if (IISHelper.IsIISApplicationExists("/Myrtille"))
                {
                    IISHelper.DeleteIISApplication("/Myrtille");
                }

                if (IISHelper.IsIISApplicationPoolExists("MyrtilleAppPool"))
                {
                    IISHelper.DeleteIISApplicationPool("MyrtilleAppPool");
                }

                // retrieve the myrtille self signed certificate
                var store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
                store.Open(OpenFlags.ReadWrite);
                var certs = store.Certificates.Find(X509FindType.FindByIssuerName, Environment.MachineName, false);
                if (certs.Count > 0)
                {
                    foreach (var cert in certs)
                    {
                        if (cert.FriendlyName == "Myrtille self-signed certificate")
                        {
                            // unbind it from the default website
                            IISHelper.UnbindCertificate(cert);

                            // remove it
                            store.Remove(cert);

                            // normally, there should be only one myrtille self-signed certificate, but let's check further (just in case)...
                            //break;
                        }
                    }
                }

                store.Close();

                Trace.TraceInformation("Uninstalled Myrtille.Web");
            }
            catch (Exception exc)
            {
                Context.LogMessage(exc.InnerException != null ? exc.InnerException.Message : exc.Message);
                Trace.TraceError("Failed to uninstall Myrtille.Web ({0})", exc);
                throw;
            }
        }
コード例 #26
0
ファイル: OperationsIIS.cs プロジェクト: DyFuente/AntDeploy
        public override void Start()
        {
            logger("Start to ApplicationPool :" + this.args.ApplicationPoolName);

            var retryStartPool = 0;

ReTryStartPool:
            retryStartPool++;

            var poolstartReult = IISHelper.ApplicationPoolStart(this.args.ApplicationPoolName);

            if (!string.IsNullOrEmpty(poolstartReult))
            {
                if (retryStartPool >= 3)
                {
                    logger($"【Error】Fail to Start IIS ApplicationPool :{this.args.ApplicationPoolName },Err:{poolstartReult},  Retry limit.");
                    return;
                }

                logger($"Fail to Start IIS ApplicationPool :{this.args.ApplicationPoolName },Err:{poolstartReult}, wait 5seconds and Retry : " + retryStartPool);
                Thread.Sleep(5000);
                goto ReTryStartPool;
            }

            logger("Success to Start ApplicationPool:" + this.args.ApplicationPoolName);

            logger("Start to IIS WebsiteStart wait 5senconds:" + this.args.SiteName);
            Thread.Sleep(5000);

            var retryStartSite = 0;

ReTryStartSite:
            retryStartSite++;

            var websiteStartResult = IISHelper.WebsiteStart(this.args.SiteName);

            if (!string.IsNullOrEmpty(websiteStartResult))
            {
                if (retryStartSite >= 3)
                {
                    logger($"【Error】Fail to Start IIS Websit :{ this.args.SiteName},Err:{websiteStartResult}, Retry limit.");
                    return;
                }

                logger($"Fail to Start IIS Website :{ this.args.SiteName},Err:{websiteStartResult}, wait 5seconds and Retry : " + retryStartSite);
                Thread.Sleep(5000);
                goto ReTryStartSite;
            }

            logger("Success to IIS WebsiteStart :" + this.args.SiteName);
            //IISHelper.WebsiteStart(this.args.SiteName);
        }
コード例 #27
0
 public IISOptionsFactory(
     ILogService log,
     IIISClient iisClient,
     IISHelper iisHelper,
     IArgumentsService arguments,
     UserRoleService userRoleService)
 {
     _iisHelper = iisHelper;
     _log       = log;
     _arguments = arguments;
     Hidden     = !(iisClient.Version.Major > 6);
     Disabled   = IIS.Disabled(userRoleService);
 }
コード例 #28
0
        private void LoadTreeView()
        {
            treeView1.Nodes.Clear();
            TreeNode parentNode = treeView1.Nodes.Add("IIS");

            parentNode.ImageIndex         = 0;
            parentNode.SelectedImageIndex = 0;
            foreach (var server in GlobalProperties.MessagingServers)
            {
                Microsoft.Web.Administration.ApplicationPoolCollection applicationPools = null;
                Microsoft.Web.Administration.SiteCollection            sites            = null;
                TreeNode node = treeView1.Nodes[0].Nodes.Add(server);
                node.ImageIndex         = 4;
                node.SelectedImageIndex = 4;
                node.Tag = IISHelper.GetServerManager(server, out applicationPools, out sites);
                TreeNode appPool = node.Nodes.Add("Application Pools");
                appPool.ImageIndex         = 1;
                appPool.SelectedImageIndex = 1;
                appPool.ContextMenuStrip   = contextMenuStripServer;
                foreach (Microsoft.Web.Administration.ApplicationPool applicationPool in applicationPools)
                {
                    TreeNode pool = appPool.Nodes.Add(applicationPool.Name);
                    pool.ImageIndex         = 1;
                    pool.SelectedImageIndex = 1;
                    pool.Tag = applicationPool;
                    pool.ContextMenuStrip = contextMenuStrip1;
                }
                TreeNode nodeWebSite = node.Nodes.Add("Sites");
                nodeWebSite.ImageIndex         = 5;
                nodeWebSite.SelectedImageIndex = 5;
                foreach (Microsoft.Web.Administration.Site site in sites)
                {
                    TreeNode nodeSites = nodeWebSite.Nodes.Add(site.Name);
                    nodeSites.ImageIndex         = 2;
                    nodeSites.SelectedImageIndex = 2;
                    nodeSites.ContextMenuStrip   = contextMenuStripWebSite;
                    nodeSites.Tag = site;
                    foreach (Microsoft.Web.Administration.Application application in site.Applications)
                    {
                        if (application.Path != @"/")
                        {
                            TreeNode applicationNode = nodeSites.Nodes.Add(application.Path);
                            applicationNode.ImageIndex         = 3;
                            applicationNode.SelectedImageIndex = 3;
                            applicationNode.ContextMenuStrip   = contextMenuStripDeletApp;
                            applicationNode.Tag = application;
                        }
                    }
                }
            }
        }
コード例 #29
0
 private void LoadIISTreeViewOnExpand(TreeNode parentNode)
 {
     parentNode.Nodes.Clear();
     parentNode.ImageIndex         = 22; //8;
     parentNode.SelectedImageIndex = 22; //8;
     foreach (var server in GlobalProperties.MessagingServers)
     {
         Microsoft.Web.Administration.ApplicationPoolCollection applicationPools = null;
         Microsoft.Web.Administration.SiteCollection            sites            = null;
         TreeNode node = parentNode.Nodes.Add(server);
         node.ImageIndex         = 9;
         node.SelectedImageIndex = 9;
         node.ContextMenuStrip   = contextMenuStrip2;
         node.Tag = IISHelper.GetServerManager(server, out applicationPools, out sites);
         TreeNode appPool = node.Nodes.Add("Application Pools");
         appPool.ImageIndex         = 10;
         appPool.SelectedImageIndex = 10;
         appPool.ContextMenuStrip   = contextMenuStripServer;
         foreach (Microsoft.Web.Administration.ApplicationPool applicationPool in applicationPools.OrderBy(x => x.Name))
         {
             TreeNode pool = appPool.Nodes.Add(applicationPool.Name);
             pool.ImageIndex         = 10;
             pool.SelectedImageIndex = 10;
             pool.Tag = applicationPool;
             pool.ContextMenuStrip = contextMenuStrip1;
         }
         TreeNode nodeWebSite = node.Nodes.Add("Sites");
         nodeWebSite.ImageIndex         = 18;
         nodeWebSite.SelectedImageIndex = 18;
         foreach (Microsoft.Web.Administration.Site site in sites.OrderBy(x => x.Name))
         {
             TreeNode nodeSites = nodeWebSite.Nodes.Add(site.Name);
             nodeSites.ImageIndex         = 11;
             nodeSites.SelectedImageIndex = 11;
             nodeSites.ContextMenuStrip   = contextMenuStripWebSite;
             nodeSites.Tag = site;
             foreach (Microsoft.Web.Administration.Application application in site.Applications.OrderBy(x => x.Path))
             {
                 if (application.Path != @"/")
                 {
                     TreeNode applicationNode = nodeSites.Nodes.Add(application.Path);
                     applicationNode.ImageIndex         = 12;
                     applicationNode.SelectedImageIndex = 12;
                     applicationNode.ContextMenuStrip   = contextMenuStripDeletApp;
                     applicationNode.Tag = application;
                 }
             }
         }
     }
     IsIISNodeExpanded = true;
 }
コード例 #30
0
 public bool OperateWebSite(string siteName, string opType)
 {
     try
     {
         IISHelper helper = new IISHelper();
         var       result = helper.OperateWebSite(siteName, opType);
         return(result);
     }
     catch (Exception ex)
     {
         log4net.LogManager.GetLogger("").Error(ex.Message);
         log4net.LogManager.GetLogger("").Error(ex.StackTrace);
         return(false);
     }
 }