public void ApplicationPoolList()
        {
            ServerManager               serverManager               = new ServerManager();
            ApplicationPoolCollection   applicationPoolCollection   = serverManager.ApplicationPools;
            ApplicationPoolProcessModel applicationPoolProcessModel = null;

            _logger.InfoFormat("[{0}] - =======================================================================================", MethodInfo.GetCurrentMethod().Name);
            _logger.InfoFormat("[{0}] - Begin ApplicationPoolCollection", MethodInfo.GetCurrentMethod().Name);
            foreach (ApplicationPool itemApplicationPool in applicationPoolCollection)
            {
                _logger.InfoFormat("[{0}] - =============================================", MethodInfo.GetCurrentMethod().Name);
                _logger.InfoFormat("[{0}] - itemApplicationPool.Name: {1}", MethodInfo.GetCurrentMethod().Name, itemApplicationPool.Name);
                _logger.InfoFormat("[{0}] - itemApplicationPool.AutoStart: {1}", MethodInfo.GetCurrentMethod().Name, itemApplicationPool.AutoStart);
                _logger.InfoFormat("[{0}] - itemApplicationPool.Enable32BitAppOnWin64: {1}", MethodInfo.GetCurrentMethod().Name, itemApplicationPool.Enable32BitAppOnWin64);
                _logger.InfoFormat("[{0}] - itemApplicationPool.ManagedRuntimeVersion: {1}", MethodInfo.GetCurrentMethod().Name, itemApplicationPool.ManagedRuntimeVersion);
                _logger.InfoFormat("[{0}] - itemApplicationPool.State: {1}", MethodInfo.GetCurrentMethod().Name, (int)itemApplicationPool.State);
                _logger.InfoFormat("[{0}] - itemApplicationPool.State[string]: {1}", MethodInfo.GetCurrentMethod().Name, itemApplicationPool.State);

                applicationPoolProcessModel = itemApplicationPool.ProcessModel;
                _logger.InfoFormat("[{0}] - applicationPoolProcessModel.IdentityType: {1}", MethodInfo.GetCurrentMethod().Name, (int)applicationPoolProcessModel.IdentityType);
                _logger.InfoFormat("[{0}] - applicationPoolProcessModel.IdentityType[string]: {1}", MethodInfo.GetCurrentMethod().Name, applicationPoolProcessModel.IdentityType);
                _logger.InfoFormat("[{0}] - applicationPoolProcessModel.UserName: {1}", MethodInfo.GetCurrentMethod().Name, applicationPoolProcessModel.UserName);
                _logger.InfoFormat("[{0}] - applicationPoolProcessModel.Password: {1}", MethodInfo.GetCurrentMethod().Name, applicationPoolProcessModel.Password);
                _logger.InfoFormat("[{0}] - =============================================", MethodInfo.GetCurrentMethod().Name);
            }
            _logger.InfoFormat("[{0}] - End ApplicationPoolCollection", MethodInfo.GetCurrentMethod().Name);
            _logger.InfoFormat("[{0}] - =======================================================================================", MethodInfo.GetCurrentMethod().Name);
        }
        public void GetApplicationPoolDetail(ApplicationPoolCollection applicationPoolCollection, string applicationPoolName)
        {
            ApplicationPoolProcessModel applicationPoolProcessModel = null;
            ApplicationPool             applicationPool             = null;

            if ((applicationPoolCollection != null) && (applicationPoolCollection.Any()))
            {
                _logger.InfoFormat("[{0}] - applicationPoolName: {1}", MethodInfo.GetCurrentMethod().Name, applicationPoolName);

                applicationPool = applicationPoolCollection.FirstOrDefault(p => p.Name == applicationPoolName);
                if (applicationPool != null)
                {
                    _logger.InfoFormat("[{0}] - applicationPool.Name: {1}", MethodInfo.GetCurrentMethod().Name, applicationPool.Name);
                    _logger.InfoFormat("[{0}] - applicationPool.AutoStart: {1}", MethodInfo.GetCurrentMethod().Name, applicationPool.AutoStart);
                    _logger.InfoFormat("[{0}] - applicationPool.Enable32BitAppOnWin64: {1}", MethodInfo.GetCurrentMethod().Name, applicationPool.Enable32BitAppOnWin64);
                    _logger.InfoFormat("[{0}] - applicationPool.ManagedRuntimeVersion: {1}", MethodInfo.GetCurrentMethod().Name, applicationPool.ManagedRuntimeVersion);
                    _logger.InfoFormat("[{0}] - applicationPool.State: {1}", MethodInfo.GetCurrentMethod().Name, (int)applicationPool.State);
                    _logger.InfoFormat("[{0}] - applicationPool.State[string]: {1}", MethodInfo.GetCurrentMethod().Name, applicationPool.State);

                    applicationPoolProcessModel = applicationPool.ProcessModel;
                    _logger.InfoFormat("[{0}] - applicationPoolProcessModel.IdentityType: {1}", MethodInfo.GetCurrentMethod().Name, (int)applicationPoolProcessModel.IdentityType);
                    _logger.InfoFormat("[{0}] - applicationPoolProcessModel.IdentityType[string]: {1}", MethodInfo.GetCurrentMethod().Name, applicationPoolProcessModel.IdentityType);
                    _logger.InfoFormat("[{0}] - applicationPoolProcessModel.UserName: {1}", MethodInfo.GetCurrentMethod().Name, applicationPoolProcessModel.UserName);
                    _logger.InfoFormat("[{0}] - applicationPoolProcessModel.Password: {1}", MethodInfo.GetCurrentMethod().Name, applicationPoolProcessModel.Password);
                }
                else
                {
                    _logger.InfoFormat("[{0}] - ApplicationPool doesn't exists", MethodInfo.GetCurrentMethod().Name);
                }
            }
            else
            {
                _logger.InfoFormat("[{0}] - Server doesn't have any ApplicationPool", MethodInfo.GetCurrentMethod().Name);
            }
        }
示例#3
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            var editorService = provider?.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

            if (editorService != null)
            {
                ApplicationPoolProcessModel element = (ApplicationPoolProcessModel)value;
                IdentityDialog dialog = new IdentityDialog(null, element);
                editorService.ShowDialog(dialog);
            }

            return(value);
        }
 public ApplicationPoolProcessModel2(ApplicationPoolProcessModel model)
 {
     IdentityType           = model.IdentityType;
     IdleTimeout            = model.IdleTimeout;
     IdleTimeoutAction      = model.IdleTimeoutAction;
     LoadUserProfile        = model.LoadUserProfile;
     MaxProcesses           = model.MaxProcesses;
     PingingEnabled         = model.PingingEnabled;
     PingInterval           = model.PingInterval;
     PingResponseTime       = model.PingResponseTime;
     Password               = model.Password;
     ShutdownTimeLimit      = model.ShutdownTimeLimit;
     StartupTimeLimit       = model.StartupTimeLimit;
     UserName               = model.UserName;
     LogEventOnProcessModel = model.LogEventOnProcessModel;
 }
        public IdentityDialog(IServiceProvider serviceProvider, ApplicationPoolProcessModel element)
            : base(serviceProvider)
        {
            _element = element;
            InitializeComponent();
            rbBuiltin.Checked = _element.IdentityType != ProcessModelIdentityType.SpecificUser;
            rbCustom.Checked  = !rbBuiltin.Checked;
            if (_element.IdentityType == ProcessModelIdentityType.SpecificUser)
            {
                txtCustom.Text = _element.UserName;
            }
            else
            {
                switch (_element.IdentityType)
                {
                case ProcessModelIdentityType.LocalSystem:
                    cbBuiltin.SelectedIndex = 1;
                    break;

                case ProcessModelIdentityType.LocalService:
                    cbBuiltin.SelectedIndex = 0;
                    break;

                case ProcessModelIdentityType.NetworkService:
                    cbBuiltin.SelectedIndex = 2;
                    break;

                case ProcessModelIdentityType.ApplicationPoolIdentity:
                    cbBuiltin.SelectedIndex = 3;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
        }
示例#6
0
        public IdentityDialog(IServiceProvider serviceProvider, ApplicationPoolProcessModel element)
            : base(serviceProvider)
        {
            InitializeComponent();
            var container = new CompositeDisposable();

            FormClosed += (sender, args) => container.Dispose();
            var password = string.Empty;

            container.Add(
                Observable.FromEventPattern <EventArgs>(btnOK, "Click")
                .ObserveOn(System.Threading.SynchronizationContext.Current)
                .Subscribe(evt =>
            {
                if (rbCustom.Checked)
                {
                    element.IdentityType = ProcessModelIdentityType.SpecificUser;
                    element.UserName     = txtCustom.Text;
                    element.SetPassword(password);
                }

                if (rbBuiltin.Checked)
                {
                    element.UserName = string.Empty;
                    switch (cbBuiltin.SelectedIndex)
                    {
                    case 0:
                        element.IdentityType = ProcessModelIdentityType.LocalService;
                        break;

                    case 1:
                        element.IdentityType = ProcessModelIdentityType.LocalSystem;
                        break;

                    case 2:
                        element.IdentityType = ProcessModelIdentityType.NetworkService;
                        break;

                    case 3:
                        element.IdentityType = ProcessModelIdentityType.ApplicationPoolIdentity;
                        break;
                    }
                }

                DialogResult = DialogResult.OK;
            }));

            container.Add(
                Observable.FromEventPattern <EventArgs>(rbBuiltin, "CheckedChanged")
                .Merge(Observable.FromEventPattern <EventArgs>(rbCustom, "CheckedChanged"))
                .Sample(TimeSpan.FromSeconds(0.5))
                .ObserveOn(System.Threading.SynchronizationContext.Current)
                .Subscribe(evt =>
            {
                txtCustom.Enabled = rbCustom.Checked;
                btnSet.Enabled    = rbCustom.Checked;
                cbBuiltin.Enabled = rbBuiltin.Checked;
                btnOK.Enabled     = (rbBuiltin.Checked && cbBuiltin.SelectedIndex > -1) || (rbCustom.Checked && txtCustom.Text.Length > 0);
            }));

            container.Add(
                Observable.FromEventPattern <EventArgs>(btnSet, "Click")
                .ObserveOn(System.Threading.SynchronizationContext.Current)
                .Subscribe(evt =>
            {
                using var dialog = new CredentialsDialog(null, txtCustom.Text);
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                txtCustom.Text = dialog.UserName;
                password       = dialog.Password;
            }));

            rbBuiltin.Checked = element.IdentityType != ProcessModelIdentityType.SpecificUser;
            rbCustom.Checked  = !rbBuiltin.Checked;
            if (element.IdentityType == ProcessModelIdentityType.SpecificUser)
            {
                txtCustom.Text = element.UserName;
            }
            else
            {
                switch (element.IdentityType)
                {
                case ProcessModelIdentityType.LocalSystem:
                    cbBuiltin.SelectedIndex = 1;
                    break;

                case ProcessModelIdentityType.LocalService:
                    cbBuiltin.SelectedIndex = 0;
                    break;

                case ProcessModelIdentityType.NetworkService:
                    cbBuiltin.SelectedIndex = 2;
                    break;

                case ProcessModelIdentityType.ApplicationPoolIdentity:
                    cbBuiltin.SelectedIndex = 3;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
        }
示例#7
0
        private Task <Tuple <StatusResult, List <string> > > compareProcessModelsAsync(ApplicationPoolProcessModel pm1, ApplicationPoolProcessModel pm2)
        {
            var errors = new List <string>();
            var result = StatusResult.Ok;

            if (pm1.IdentityType != pm2.IdentityType)
            {
                errors.Add(string.Format("{0} - "));
            }

            return(Task.FromResult <Tuple <StatusResult, List <string> > >(new Tuple <StatusResult, List <string> >(result, errors)));
        }