public static void ThrowIfNull(this App application, string name)
 {
     if (application is null)
     {
         throw new ApplicationNotExistsException(name);
     }
 }
Esempio n. 2
0
        public ApplicationPage(Application application, MainForm main)
        {
            InitializeComponent();
            btnView.Image    = DefaultTaskList.ViewImage;
            btnGo.Image      = DefaultTaskList.GoImage;
            btnShowAll.Image = DefaultTaskList.ShowAllImage;

            _application = application;
            _main        = main;
        }
Esempio n. 3
0
        private void toolStripMenuItem3_Click(object sender, EventArgs e)
        {
            this.FormState = FormStateEnum.Processing;
            IISDeploymentTool iisActionTool = new IISDeploymentTool(3);

            Microsoft.Web.Administration.Application app = treeViewBizTalkApplications.SelectedNode.Tag as Microsoft.Web.Administration.Application;
            if (app != null)
            {
                iisActionTool.applicationPoolName = app.ApplicationPoolName;
                iisActionTool.ShowDialog();
            }
            this.FormState = FormStateEnum.NotProcessing;
        }
        void publish(ExecutionLogInterface log, bool filesOnly)
        {
            log.Log("Starting Web Site Publishing...");
            _publicationInError = false;
            try
            {
                string publicationDirectory = _configuration.WebPublicationDirectory;
                string sourceDirectory      = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Web");
#if DEBUG
                sourceDirectory = Path.GetDirectoryName(Application.ExecutablePath) + @"\..\..\..\SealWebServer\";
#endif

                //Copy installation directory
                log.Log("Copying files from '{0}' to '{1}'", sourceDirectory, publicationDirectory);
                FileHelper.CopyDirectory(sourceDirectory, publicationDirectory, true);

                //Check web config...
                if (!File.Exists(Path.Combine(publicationDirectory, "web.config")) && File.Exists(Path.Combine(publicationDirectory, "web.release.config")))
                {
                    log.Log("Creating web.config file");
                    File.Copy(Path.Combine(publicationDirectory, "web.release.config"), Path.Combine(publicationDirectory, "web.config"));
                }

                if (!filesOnly && !log.IsJobCancelled())
                {
                    log.Log("Publishing Site on IIS...");

                    Microsoft.Web.Administration.ServerManager serverMgr = new Microsoft.Web.Administration.ServerManager();
                    Microsoft.Web.Administration.Site          site      = null;
                    if (serverMgr.Sites.Count == 0)
                    {
                        log.Log("Creating Default Web Site");
                        site = serverMgr.Sites.Add("Default Web Site", "C:\\inetpub\\wwwroot", 80);
                    }
                    else
                    {
                        site = serverMgr.Sites[0];
                    }

                    Microsoft.Web.Administration.ApplicationPool pool = serverMgr.ApplicationPools.FirstOrDefault(i => i.Name == _configuration.WebApplicationPoolName);
                    if (pool == null)
                    {
                        log.Log("Creating Application Pool");
                        pool = serverMgr.ApplicationPools.Add(_configuration.WebApplicationPoolName);
                    }
                    pool.ManagedRuntimeVersion     = "v4.0";
                    pool.Enable32BitAppOnWin64     = true;
                    pool.ProcessModel.IdentityType = Microsoft.Web.Administration.ProcessModelIdentityType.LocalSystem;

                    Microsoft.Web.Administration.Application application = site.Applications.FirstOrDefault(i => i.Path == _configuration.WebApplicationName);
                    if (application == null)
                    {
                        log.Log("Creating Application");
                        application = site.Applications.Add(_configuration.WebApplicationName, _configuration.WebPublicationDirectory);
                    }
                    application.ApplicationPoolName = _configuration.WebApplicationPoolName;
                    if (!log.IsJobCancelled())
                    {
                        serverMgr.CommitChanges();
                    }
                    log.Log("Web Site has been published successfully.");
                }
            }
            catch (Exception ex)
            {
                _publicationInError = true;
                log.Log("\r\n[UNEXPECTED ERROR RECEIVED]\r\n{0}\r\n", ex.Message);
                if (ex.InnerException != null)
                {
                    log.Log("{0}\r\n", ex.InnerException.Message);
                }
            }
            log.Log("Web Site Publishing terminated.");
            if (log.IsJobCancelled())
            {
                log.Log("Publication has been cancelled.");
            }
        }
 public static void ThrowIfExists(this App application)
 {
     if (application is {})