public ApplicationPoolAdvancedSettings(ApplicationPool pool)
        {
            if (pool.ManagedRuntimeVersion == ApplicationPool.ManagedRuntimeVersion40)
            {
                CLRVersion = CLRVersion.V40;
            }
            else if (pool.ManagedRuntimeVersion == ApplicationPool.ManagedRuntimeVersion20)
            {
                CLRVersion = CLRVersion.V20;
            }
            else
            {
                CLRVersion = CLRVersion.NoManagedCode;
            }

            Enable32Bit = pool.Enable32BitAppOnWin64;
            Mode        = pool.ManagedPipelineMode;
            Name        = pool.Name;
            QueueLength = pool.QueueLength;
            Start       = pool.StartMode;

            Limit       = pool.Cpu.Limit;
            Action      = pool.Cpu.Action;
            Interval    = pool.Cpu.ResetInterval.GetTotalMinutes();
            Affinitized = pool.Cpu.SmpAffinitized;
            Mask        = pool.Cpu.SmpProcessorAffinityMask;
            Mask2       = pool.Cpu.SmpProcessorAffinityMask2;

            LogEntry = new LogEntrySettings();
            ConfigurationAttributeSchema enumLog = pool.ProcessModel.Schema.AttributeSchemas["logEventOnProcessModel"];

            if (enumLog != null)
            {
                if (enumLog.GetEnumValues().Count > 1)
                {
                    LogEntry.IdleTimeout = pool.ProcessModel.LogEventOnProcessModel
                                           == ProcessModelLogEventOnProcessModel.IdleTimeout;
                }
                else
                {
                    // IMPORTANT: workaround for IIS 8 Express.
                    HideProperty(GetType(), nameof(LogEntry));
                }
            }
            else
            {
                HideProperty(GetType(), nameof(LogEntry));
                LogEntry.IdleTimeout = true;
            }

            Identity    = pool.ProcessModel;
            IdleTimeout = pool.ProcessModel.IdleTimeout.GetTotalMinutes();
            if (pool.ProcessModel.Schema.AttributeSchemas["idleTimeoutAction"] != null)
            {
                IdleAction = pool.ProcessModel.IdleTimeoutAction;
            }
            else
            {
                HideProperty(GetType(), nameof(IdleAction));
            }

            LoadUserProfile   = pool.ProcessModel.LoadUserProfile;
            MaxProcesses      = pool.ProcessModel.MaxProcesses;
            PingingEnabled    = pool.ProcessModel.PingingEnabled;
            PingResponseTime  = pool.ProcessModel.PingResponseTime.GetTotalSeconds();
            PingInterval      = pool.ProcessModel.PingInterval.GetTotalSeconds();
            ShutdownTimeLimit = pool.ProcessModel.ShutdownTimeLimit.GetTotalSeconds();
            StartupTimeLimit  = pool.ProcessModel.StartupTimeLimit.GetTotalSeconds();

            OrphanWorkerProcess = pool.Failure.OrphanWorkerProcess;
            OrphanActionExe     = pool.Failure.OrphanActionExe;
            OrphanActionParams  = pool.Failure.OrphanActionParams;

            LoadBalancerCapabilities      = pool.Failure.LoadBalancerCapabilities;
            RapidFailProtection           = pool.Failure.RapidFailProtection;
            RapidFailProtectionInterval   = pool.Failure.RapidFailProtectionInterval.GetTotalMinutes();
            RapidFailProtectionMaxCrashes = pool.Failure.RapidFailProtectionMaxCrashes;
            AutoShutdownExe    = pool.Failure.AutoShutdownExe;
            AutoShutdownParams = pool.Failure.AutoShutdownParams;

            DisallowOverlappingRotation    = pool.Recycling.DisallowOverlappingRotation;
            DisallowRotationOnConfigChange = pool.Recycling.DisallowRotationOnConfigChange;
            var flags = pool.Recycling.LogEventOnRecycle;

            GenerateRecycleEventLogEntry = new GenerateRecycleEventLogEntry();
            GenerateRecycleEventLogEntry.ConfigChange   = (flags & RecyclingLogEventOnRecycle.ConfigChange) == RecyclingLogEventOnRecycle.ConfigChange;
            GenerateRecycleEventLogEntry.IsapiUnhealthy = (flags & RecyclingLogEventOnRecycle.IsapiUnhealthy) == RecyclingLogEventOnRecycle.IsapiUnhealthy;
            GenerateRecycleEventLogEntry.OnDemand       = (flags & RecyclingLogEventOnRecycle.OnDemand) == RecyclingLogEventOnRecycle.OnDemand;
            GenerateRecycleEventLogEntry.PrivateMemory  = (flags & RecyclingLogEventOnRecycle.PrivateMemory) == RecyclingLogEventOnRecycle.PrivateMemory;
            GenerateRecycleEventLogEntry.Time           = (flags & RecyclingLogEventOnRecycle.Time) == RecyclingLogEventOnRecycle.Time;
            GenerateRecycleEventLogEntry.Requests       = (flags & RecyclingLogEventOnRecycle.Requests) == RecyclingLogEventOnRecycle.Requests;
            GenerateRecycleEventLogEntry.Schedule       = (flags & RecyclingLogEventOnRecycle.Schedule) == RecyclingLogEventOnRecycle.Schedule;
            GenerateRecycleEventLogEntry.Memory         = (flags & RecyclingLogEventOnRecycle.Memory) == RecyclingLogEventOnRecycle.Memory;

            PrivateMemory = pool.Recycling.PeriodicRestart.PrivateMemory;
            Time          = pool.Recycling.PeriodicRestart.Time.GetTotalMinutes();
            Requests      = pool.Recycling.PeriodicRestart.Requests;
            Schedule      = pool.Recycling.PeriodicRestart.Schedule;
            Memory        = pool.Recycling.PeriodicRestart.Memory;
        }
예제 #2
0
        public ApplicationPoolAdvancedSettings(ApplicationPool pool)
        {
            if (pool.ManagedRuntimeVersion == "v4.0")
            {
                CLRVersion = CLRVersion.V40;
            }
            else if (pool.ManagedRuntimeVersion == "v2.0")
            {
                CLRVersion = CLRVersion.V20;
            }
            else
            {
                CLRVersion = CLRVersion.NoManagedCode;
            }

            Enable32Bit = pool.Enable32BitAppOnWin64;
            Mode        = pool.ManagedPipelineMode;
            Name        = pool.Name;
            QueueLength = pool.QueueLength;
            Start       = pool.StartMode;

            Limit       = pool.Cpu.Limit;
            Action      = pool.Cpu.Action;
            Interval    = pool.Cpu.ResetInterval.GetTotalMinutes();
            Affinitized = pool.Cpu.SmpAffinitized;
            Mask        = pool.Cpu.SmpProcessorAffinityMask;
            Mask2       = pool.Cpu.SmpProcessorAffinityMask2;

            LogEntry = new LogEntrySettings();
            ConfigurationAttributeSchema enumLog = pool.ProcessModel.Schema.AttributeSchemas["logEventOnProcessModel"];

            if (enumLog != null)
            {
                if (enumLog.GetEnumValues().Count > 1)
                {
                    this.LogEntry.IdleTimeout = pool.ProcessModel.LogEventOnProcessModel
                                                == ProcessModelLogEventOnProcessModel.IdleTimeout;
                }
                else
                {
                    // IMPORTANT: workaround for IIS 8 Express.
                    HideProperty(this.GetType(), nameof(this.LogEntry));
                }
            }
            else
            {
                HideProperty(this.GetType(), nameof(LogEntry));
                this.LogEntry.IdleTimeout = true;
            }

            IdleTimeout = pool.ProcessModel.IdleTimeout.GetTotalMinutes();
            if (pool.ProcessModel.Schema.AttributeSchemas["idleTimeoutAction"] != null)
            {
                IdleAction = pool.ProcessModel.IdleTimeoutAction;
            }
            else
            {
                HideProperty(this.GetType(), nameof(this.IdleAction));
            }

            MaxProcesses  = pool.ProcessModel.MaxProcesses;
            this.Identity = pool.ProcessModel;
        }