示例#1
0
        private void PopulateManagedSiteSettings(string siteId)
        {
            ValidationError = null;
            var managedSite = SelectedItem;

            managedSite.Name    = SelectedWebSite.SiteName;
            managedSite.GroupId = SelectedWebSite.SiteId;

            //TODO: if this site would be a duplicate need to increment the site name

            //set defaults first
            managedSite.RequestConfig.WebsiteRootPath = Environment.ExpandEnvironmentVariables(SelectedWebSite.PhysicalPath);
            managedSite.RequestConfig.PerformExtensionlessConfigChecks = true;
            managedSite.RequestConfig.PerformTlsSniBindingConfigChecks = true;
            managedSite.RequestConfig.PerformChallengeFileCopy         = true;
            managedSite.RequestConfig.PerformAutomatedCertBinding      = true;
            managedSite.RequestConfig.PerformAutoConfig          = true;
            managedSite.RequestConfig.EnableFailureNotifications = true;
            managedSite.RequestConfig.ChallengeType = ACMESharpCompat.ACMESharpUtils.CHALLENGE_TYPE_HTTP;
            managedSite.IncludeInAutoRenew          = true;
            managedSite.ClearDomainOptions();
            //for the given selected web site, allow the user to choose which domains to combine into one certificate

            List <DomainOption> domainOptions = certifyManager.GetDomainOptionsFromSite(siteId);

            if (domainOptions.Any())
            {
                managedSite.AddDomainOptions(domainOptions);
            }

            if (!managedSite.DomainOptions.Any())
            {
                ValidationError = "The selected site has no domain bindings setup. Configure the domains first using Edit Bindings in IIS.";
            }

            //TODO: load settings from previously saved managed site?
            RaisePropertyChanged(nameof(PrimarySubjectDomain));

            RaisePropertyChanged(nameof(HasSelectedItemDomainOptions));
        }