Esempio n. 1
0
        private void Initialize(Application application, string siteKey, string siteName, WebAuthenticationInformation authInfo)
        {
            this.Key = GetApplicationVariableName(siteName, application.Path);
            this.IsRootApplication = (application.Path == "/");

            string name = application.Path.StartsWith("/") ? application.Path.Substring(1) : application.Path;

            AddAttribute("Name", name);

            AddAttribute("Ensure", "Present");
            AddAttribute("Website", siteName);
            AddAttribute("PhysicalPath", application.VirtualDirectories[0].PhysicalPath);

            this.ApplicationPool = application.ApplicationPoolName;
            AddAttribute("WebAppPool", this.ApplicationPool);

            AddAttribute("DependsOn", "[xWebAppPool]" + PoolDesiredState.GetPoolVariableName(application.ApplicationPoolName));

            this.VirtualDirectories = GetVirtualDirectories(application.VirtualDirectories, siteName, application.Path);
            this.AuthenticationInfo = authInfo;
        }
        public SiteDesiredState(Site iisSiteObject
                                , List <WebConfigEntry> configEntries
                                , IISCodeGenerator.IisPoolAndSitesOptions iisOptions)
        {
            var rootApp = iisSiteObject.Applications[0];

            this.Key = GetSiteKey(iisSiteObject.Name);

            this.AddAttribute("Name", iisSiteObject.Name);
            this.AddAttribute("Ensure", "Present");
            this.AddAttribute("State", iisSiteObject.State.ToString());

            this.ApplicationPool = rootApp.ApplicationPoolName;
            this.AddAttribute("ApplicationPool", this.ApplicationPool);

            this.AddAttributeWithComment("PhysicalPath", rootApp.VirtualDirectories[0].PhysicalPath, "This folder must already exist");

            string logAttributeName = "LogPath";

            if (iisOptions.StandardizeLogFileLocation)
            {
                this.AddAttributeWithOverrideValue(logAttributeName, "$logFilePath", iisSiteObject.LogFile.Directory);
            }
            else
            {
                this.AddAttribute(logAttributeName, iisSiteObject.LogFile.Directory);
            }

            this.AddAttribute("DependsOn", "[xWebAppPool]" + PoolDesiredState.GetPoolVariableName(this.ApplicationPool));

            this.Bindings = GetBindings(iisSiteObject.Bindings);

            this.AuthenticationInfo = GetSiteAuthenticationConfiguration(configEntries, iisSiteObject.Name);

            Dictionary <string, WebAuthenticationInformation> authEntries = GetAppsAuthenticationConfigurations(configEntries);

            this.Applications = GetApplications(iisSiteObject.Applications, this.Key, this.Name, authEntries);

            //todo this.AllWebConfigEntryList.AddRange(configEntries);
        }
Esempio n. 3
0
 public ApplicationDesiredState(Application application, string siteKey, string siteName, WebAuthenticationInformation authInfo)
 {
     Initialize(application, siteKey, siteName, authInfo);
 }