狠狠色丁香婷婷综合尤物/久久精品综合一区二区三区/中国有色金属学报/国产日韩欧美在线观看 - 国产一区二区三区四区五区tv

LOGO OA教程 ERP教程 模切知識交流 PMS教程 CRM教程 開發文檔 其他文檔  
 
網站管理員

c#創建并設置應用程序池

admin
2018年9月8日 15:42 本文熱度 5584
/// <summary>
/// 創建應用程序池 IIS 7 默認是 FrameWork 4.0  集成模式
/// </summary>
/// <param name="appPoolName"></param>
/// <param name="maxProcesses">最大進程數</param>
/// <param name="queueLength">隊列長度</param>
/// <param name="type">0為集成模式1為經理模式</param>
public static bool CreateAppPool7(string appPoolName, long maxProcesses,long queueLength,string type)
{
    try
    {
        ServerManager sm = new ServerManager();
        //判斷是否存在應用程序池
        ApplicationPool appPool = sm.ApplicationPools[appPoolName];
        if (appPool == null)
        {
            sm.ApplicationPools.Add(appPoolName);
            ApplicationPool apppool = sm.ApplicationPools[appPoolName];
            if ("0".Equals(type))
            {
                apppool.ManagedPipelineMode = ManagedPipelineMode.Integrated;//托管管道為集成模式  ManagedPipelineMode.Classic為經典模式
            }
            else {
                apppool.ManagedPipelineMode = ManagedPipelineMode.Classic;//托管管道為經典模式  ManagedPipelineMode.Classic為經典模式
            }
         
            apppool.ManagedRuntimeVersion = "v4.0";  //當設置錯誤時,會在應用程序中創建一個不存在的版本,不會報錯
            //應當檢測當前電腦是否安裝 FrameWork 4.0 ,并處理沒有安裝時該怎么辦
            //apppool.QueueLength
            apppool.Recycling.DisallowOverlappingRotation = false;
            apppool.Recycling.PeriodicRestart.Time = TimeSpan.FromMinutes(0);
            apppool.Recycling.PeriodicRestart.Schedule.Add(TimeSpan.Parse("23:00:00"));
            apppool.Recycling.PeriodicRestart.Schedule.Add(TimeSpan.Parse("06:00:00"));
            apppool.Recycling.PeriodicRestart.Schedule.Add(TimeSpan.Parse("12:30:00"));
            apppool.Recycling.PeriodicRestart.Schedule.Add(TimeSpan.Parse("18:00:00"));
            apppool.Recycling.LogEventOnRecycle = RecyclingLogEventOnRecycle.Memory
                | RecyclingLogEventOnRecycle.Requests
                | RecyclingLogEventOnRecycle.ConfigChange
                | RecyclingLogEventOnRecycle.IsapiUnhealthy
                | RecyclingLogEventOnRecycle.OnDemand
                | RecyclingLogEventOnRecycle.PrivateMemory
                | RecyclingLogEventOnRecycle.Schedule
                | RecyclingLogEventOnRecycle.Time;
            apppool.Recycling.PeriodicRestart.Memory = 40960000;
            apppool.Recycling.PeriodicRestart.PrivateMemory= 0;
            apppool.ProcessModel.IdleTimeout = TimeSpan.FromMinutes(0);
            apppool.ProcessModel.MaxProcesses= maxProcesses;
            apppool.ProcessModel.ShutdownTimeLimit = TimeSpan.FromSeconds(120);//關閉時間限制設置為120秒
            apppool.QueueLength = queueLength;
            apppool.Cpu.Limit = 80000;
            apppool.Cpu.Action=ProcessorAction.KillW3wp;
            apppool.Failure.RapidFailProtection = false;
            apppool.AutoStart = true;
            sm.CommitChanges();
            apppool.Recycle();
          
        }
        else
        {
            //appPool.ManagedPipelineMode = ManagedPipelineMode.Integrated;//托管管道為集成模式  ManagedPipelineMode.Classic為經典模式
            if ("0".Equals(type))
            {
                appPool.ManagedPipelineMode = ManagedPipelineMode.Integrated;//托管管道為集成模式  ManagedPipelineMode.Classic為經典模式
            }
            else
            {
                appPool.ManagedPipelineMode = ManagedPipelineMode.Classic;//托管管道為經典模式  ManagedPipelineMode.Classic為經典模式
            }
            appPool.ManagedRuntimeVersion = "v4.0";  //當設置錯誤時,會在應用程序中創建一個不存在的版本,不會報錯
            //應當檢測當前電腦是否安裝 FrameWork 4.0 ,并處理沒有安裝時該怎么辦
            appPool.Recycling.DisallowOverlappingRotation = false;
            appPool.Recycling.PeriodicRestart.Time = TimeSpan.FromMinutes(0);
            appPool.Recycling.PeriodicRestart.Schedule.Clear();
            appPool.Recycling.PeriodicRestart.Schedule.Add(TimeSpan.Parse("23:00:00"));
            appPool.Recycling.PeriodicRestart.Schedule.Add(TimeSpan.Parse("06:00:00"));
            appPool.Recycling.PeriodicRestart.Schedule.Add(TimeSpan.Parse("12:30:00"));
            appPool.Recycling.PeriodicRestart.Schedule.Add(TimeSpan.Parse("18:00:00"));
            appPool.Recycling.LogEventOnRecycle = RecyclingLogEventOnRecycle.Memory
                | RecyclingLogEventOnRecycle.Requests
                | RecyclingLogEventOnRecycle.ConfigChange
                | RecyclingLogEventOnRecycle.IsapiUnhealthy
                | RecyclingLogEventOnRecycle.OnDemand
                | RecyclingLogEventOnRecycle.PrivateMemory
                | RecyclingLogEventOnRecycle.Schedule
                | RecyclingLogEventOnRecycle.Time;
            appPool.Recycling.PeriodicRestart.Memory = 40960000;
            appPool.Recycling.PeriodicRestart.PrivateMemory = 0;
            appPool.ProcessModel.IdleTimeout = TimeSpan.FromMinutes(0);
            appPool.ProcessModel.MaxProcesses = maxProcesses;
            appPool.ProcessModel.ShutdownTimeLimit = TimeSpan.FromSeconds(120);//關閉時間限制設置為120秒
            appPool.QueueLength = queueLength;
            appPool.Cpu.Limit = 80000;
            appPool.Cpu.Action = ProcessorAction.KillW3wp;
            appPool.Failure.RapidFailProtection = false;
            appPool.AutoStart = true;
            sm.CommitChanges();
            appPool.Recycle();
        }
    }
    catch
    {
        return false;
    }
    return true;
}

該文章在 2018/9/8 15:42:01 編輯過
關鍵字查詢
相關文章
正在查詢...
點晴ERP是一款針對中小制造業的專業生產管理軟件系統,系統成熟度和易用性得到了國內大量中小企業的青睞。
點晴PMS碼頭管理系統主要針對港口碼頭集裝箱與散貨日常運作、調度、堆場、車隊、財務費用、相關報表等業務管理,結合碼頭的業務特點,圍繞調度、堆場作業而開發的。集技術的先進性、管理的有效性于一體,是物流碼頭及其他港口類企業的高效ERP管理信息系統。
點晴WMS倉儲管理系統提供了貨物產品管理,銷售管理,采購管理,倉儲管理,倉庫管理,保質期管理,貨位管理,庫位管理,生產管理,WMS管理系統,標簽打印,條形碼,二維碼管理,批號管理軟件。
點晴免費OA是一款軟件和通用服務都免費,不限功能、不限時間、不限用戶的免費OA協同辦公管理系統。
Copyright 2010-2025 ClickSun All Rights Reserved