예제 #1
0
        public void Create(Website website)
        {
            //currenly only IIS 7
            using (var iisManager = new ServerManager())
            {
                var pool = iisManager.CreateAppPool(website.AppPool);
                pool.ManagedRuntimeVersion = "v4.0";
                pool.ManagedPipelineMode = ManagedPipelineMode.Integrated;
                pool.Enable32BitAppOnWin64 = false;

                if (website.HasCredentials())
                {
                    pool.ProcessModel.UserName = website.Username;
                    pool.ProcessModel.Password = website.Password;
                }

                LogWriter.Current.Indent(() =>
                {
                    Site site = createSite(website, iisManager);

                    Application app = createApp(website, site);

                    //flush the changes so that we can now tweak them.
                    iisManager.CommitChanges();

                    app.DirectoryBrowsing(website.DirectoryBrowsing);

                    // TODO -- just take these out
                    //app.AnonAuthentication(website.AnonAuth);
                    //app.BasicAuthentication(website.BasicAuth);
                    //app.WindowsAuthentication(website.WindowsAuth);

                    iisManager.CommitChanges();

                    LogWriter.Current.Success("Success.");
                });
            }
        }