コード例 #1
0
 public static void CreateApplicationPool(ApplicationPool applicationPool)
 {
     using (var manager = new ServerManager())
     {
         Microsoft.Web.Administration.ApplicationPool newAppPool = manager.ApplicationPools.Add(applicationPool.Name);
         newAppPool.UpdateIisApplicationPoolFromServant(applicationPool);
         manager.CommitChanges();
     }
 }
コード例 #2
0
        private static Microsoft.Web.Administration.ApplicationPool UpdateIisApplicationPoolFromServant(this Microsoft.Web.Administration.ApplicationPool iisApplicationPool, ApplicationPool servantApplicationPool)
        {
            ManagedPipelineMode pipelineMode;

            Enum.TryParse(servantApplicationPool.PipelineMode, true, out pipelineMode);
            LoadBalancerCapabilities loadBalancerCapabilities;

            Enum.TryParse(servantApplicationPool.ServiceUnavailableResponseType, true, out loadBalancerCapabilities);

            iisApplicationPool.Name                  = servantApplicationPool.Name;
            iisApplicationPool.AutoStart             = servantApplicationPool.AutoStart;
            iisApplicationPool.ManagedRuntimeVersion = servantApplicationPool.ClrVersion;
            iisApplicationPool.ManagedPipelineMode   = pipelineMode;
            iisApplicationPool.Recycling.DisallowOverlappingRotation    = servantApplicationPool.DisallowOverlappingRotation;
            iisApplicationPool.Recycling.DisallowRotationOnConfigChange = servantApplicationPool.DisallowRotationOnConfigChange;
            iisApplicationPool.Recycling.PeriodicRestart.Time           = servantApplicationPool.RecycleInterval;
            iisApplicationPool.Recycling.PeriodicRestart.PrivateMemory  = servantApplicationPool.RecyclePrivateMemoryLimit;
            iisApplicationPool.Recycling.PeriodicRestart.Memory         = servantApplicationPool.RecycleVirtualMemoryLimit;
            iisApplicationPool.Recycling.PeriodicRestart.Requests       = servantApplicationPool.RecycleRequestsLimit;
            iisApplicationPool.ProcessModel.IdleTimeout              = servantApplicationPool.IdleTimeout;
            iisApplicationPool.ProcessModel.MaxProcesses             = servantApplicationPool.MaximumWorkerProcesses;
            iisApplicationPool.ProcessModel.PingingEnabled           = servantApplicationPool.PingingEnabled;
            iisApplicationPool.ProcessModel.PingResponseTime         = servantApplicationPool.PingMaximumResponseTime;
            iisApplicationPool.Failure.LoadBalancerCapabilities      = loadBalancerCapabilities;
            iisApplicationPool.Failure.RapidFailProtection           = servantApplicationPool.RapidFailProtectionEnabled;
            iisApplicationPool.Failure.RapidFailProtectionInterval   = servantApplicationPool.RapidFailProtectionInterval;
            iisApplicationPool.Failure.RapidFailProtectionMaxCrashes = servantApplicationPool.RapidFailProtectionMaxCrashes;
            // Husk at opdatere GetDefaultApplicationPool

            return(iisApplicationPool);
        }