利用IIS7自帶類庫管理IIS現在變的更強大更方便,而完全可以不需要用DirecotryEntry這個類了(樂博網中很多.net管理iis6.0的文章都用到了DirecotryEntry這個類 ),Microsoft.Web.Administration.dll位於IIS的目錄(%WinDir%\\System32\\InetSrv)下,使用時需要引用,它基本上可以管理IIS7的各項配置。
這個類庫的主體結構如下:
這里只舉幾個例子說明一下基本功能,更多功能請參考MSDN。
建立站點
string SiteName="樂博網"; //站點名稱 string BindArgs="*:80:"; //綁定參數,注意格式 string apl="http"; //類型 string path="e:\\樂博網"; //網站路徑 ServerManager sm = new ServerManager(); sm.Sites.Add(SiteName,apl,BindArgs,path); sm.CommitChanges();
修改站點
Site site=sm.Sites["newsite"]; site.Name=SiteName; site.Bindings[0].EndPoint.Port=9999; site.Applications[0].VirtualDirectories[0].PhysicalPath=path; sm.CommitChanges();
刪除站點
Site site=sm.Sites["樂博網"]; sm.Sites.Remove(site); sm.CommitChanges();
站點操作
方法一:
1 #region CreateWebsite 添加網站 2 3 public string CreateWebSite(string serverID, string serverComment, string defaultVrootPath, string HostName, string IP, string Port) 4 { 5 try 6 { 7 ManagementObject oW3SVC = new ManagementObject (_scope, new ManagementPath(@"IIsWebService='W3SVC'"), null); 8 if (IsWebSiteExists (serverID)) 9 { 10 return "Site Already Exists..."; 11 } 12 13 ManagementBaseObject inputParameters = oW3SVC.GetMethodParameters ("CreateNewSite"); 14 ManagementBaseObject[] serverBinding = new ManagementBaseObject[1]; 15 16 serverBinding[0] = CreateServerBinding(HostName, IP, Port); 17 18 inputParameters["ServerComment"] = serverComment; 19 inputParameters["ServerBindings"] = serverBinding; 20 inputParameters["PathOfRootVirtualDir"] = defaultVrootPath; 21 inputParameters["ServerId"] = serverID; 22 23 ManagementBaseObject outParameter = null; 24 outParameter = oW3SVC.InvokeMethod("CreateNewSite", inputParameters, null); 25 26 // 啟動網站 27 string serverName = "W3SVC/" + serverID; 28 ManagementObject webSite = new ManagementObject(_scope, new ManagementPath(@"IIsWebServer='" + serverName + "'"), null); 29 webSite.InvokeMethod("Start", null); 30 31 return (string)outParameter.Properties["ReturnValue"].Value; 32 33 } 34 catch (Exception ex) 35 { 36 return ex.Message; 37 } 38 39 } 40 41 public ManagementObject CreateServerBinding(string HostName, string IP, string Port) 42 { 43 try 44 { 45 ManagementClass classBinding = new ManagementClass(_scope, new ManagementPath("ServerBinding"), null); 46 47 ManagementObject serverBinding = classBinding.CreateInstance(); 48 49 serverBinding.Properties["Hostname"].Value = HostName; 50 serverBinding.Properties["IP"].Value = IP; 51 serverBinding.Properties["Port"].Value = Port; 52 serverBinding.Put(); 53 54 return serverBinding; 55 } 56 catch 57 { 58 return null; 59 } 60 } 61 62 #endregion 63 64 #region 添加網站事件 65 66 protected void AddWebsite_Click(object sender, EventArgs e) 67 { 68 IISManager iis = new IISManager(); 69 70 iis.Connect(); 71 72 string serverID = "5556"; 73 string serverComment = "Create Website"; 74 string defaultVrootPath = @"D:\web"; 75 string HostName = "World"; 76 string IP = ""; 77 string Port = "9898"; 78 79 ReturnMessage.Text = iis.CreateWebSite(serverID,serverComment,defaultVrootPath,HostName,IP,Port); 80 } 81 82 #endregion 83 84 #region DeleteSite 刪除站點 85 86 public string DeleteSite(string serverID) 87 { 88 try 89 { 90 string serverName = "W3SVC/" + serverID; 91 ManagementObject webSite = new ManagementObject(_scope, new ManagementPath(@"IIsWebServer='" + serverName + "'"), null); 92 webSite.InvokeMethod("Stop", null); 93 webSite.Delete(); 94 webSite = null; 95 96 return "Delete the site succesfully!"; 97 } 98 catch (Exception deleteEx) 99 { 100 return deleteEx.Message; 101 } 102 } 103 104 #endregion
方法二:
1 using System; 2 using System.Collections.Generic; 3 using System.Text; 4 using System.DirectoryServices; 5 namespace WindowsApplication1 6 { 7 class IISManager 8 { 9 public IISManager() 10 { 11 } 12 public static string VirDirSchemaName = "IIsWebVirtualDir"; 13 private string _serverName; 14 public string ServerName 15 { 16 get 17 { 18 return _serverName; 19 } 20 set 21 { 22 _serverName = value; 23 } 24 } 25 26 /// <summary> 27 /// 創建網站或虛擬目錄 28 /// </summary> 29 /// <param name="WebSite">服務器站點名稱(localhost)</param> 30 /// <param name="VDirName">虛擬目錄名稱</param> 31 /// <param name="Path">實際路徑</param> 32 /// <param name="RootDir">true=網站;false=虛擬目錄</param> 33 /// <param name="iAuth">設置目錄的安全性,0不允許匿名訪問,1為允許,2基本身份驗證,3允許匿名+基本身份驗證,4整合Windows驗證,5允許匿名+整合Windows驗證...更多請查閱MSDN</param> 34 /// <param name="webSiteNum">1</param> 35 /// <param name="serverName">一般為localhost</param> 36 /// <returns></returns> 37 public bool CreateWebSite(string WebSite, string VDirName, string Path, bool RootDir, int iAuth, int webSiteNum, string serverName) 38 { 39 try 40 { 41 System.DirectoryServices.DirectoryEntry IISSchema; 42 System.DirectoryServices.DirectoryEntry IISAdmin; 43 System.DirectoryServices.DirectoryEntry VDir; 44 bool IISUnderNT; 45 46 // 47 // 確定IIS版本 48 // 49 IISSchema = new System.DirectoryServices.DirectoryEntry("IIS://" + serverName + "/Schema/AppIsolated"); 50 if (IISSchema.Properties["Syntax"].Value.ToString().ToUpper() == "BOOLEAN") 51 IISUnderNT = true; 52 else 53 IISUnderNT = false; 54 IISSchema.Dispose(); 55 // 56 // Get the admin object 57 // 獲得管理權限 58 // 59 IISAdmin = new System.DirectoryServices.DirectoryEntry("IIS://" + serverName + "/W3SVC/" + webSiteNum + "/Root"); 60 // 61 // If we're not creating a root directory 62 // 如果我們不能創建一個根目錄 63 // 64 if (!RootDir) 65 { 66 // 67 // If the virtual directory already exists then delete it 68 // 如果虛擬目錄已經存在則刪除 69 // 70 foreach (System.DirectoryServices.DirectoryEntry v in IISAdmin.Children) 71 { 72 if (v.Name == VDirName) 73 { 74 // Delete the specified virtual directory if it already exists 75 try 76 { 77 IISAdmin.Invoke("Delete", new string[] { v.SchemaClassName, VDirName }); 78 IISAdmin.CommitChanges(); 79 } 80 catch (Exception ex) 81 { 82 throw ex; 83 } 84 } 85 } 86 } 87 // 88 // Create the virtual directory 89 // 創建一個虛擬目錄 90 // 91 if (!RootDir) 92 { 93 VDir = IISAdmin.Children.Add(VDirName, "IIsWebVirtualDir"); 94 } 95 else 96 { 97 VDir = IISAdmin; 98 } 99 // 100 // Make it a web application 101 // 創建一個web應用 102 // 103 if (IISUnderNT) 104 { 105 VDir.Invoke("AppCreate", false); 106 } 107 else 108 { 109 VDir.Invoke("AppCreate", true); 110 } 111 // 112 // Setup the VDir 113 // 安裝虛擬目錄 114 //AppFriendlyName,propertyName,, bool chkRead,bool chkWrite, bool chkExecute, bool chkScript,, true, false, false, true 115 VDir.Properties["AppFriendlyName"][0] = VDirName; //應用程序名稱 116 VDir.Properties["AccessRead"][0] = true; //設置讀取權限 117 VDir.Properties["AccessExecute"][0] = false; 118 VDir.Properties["AccessWrite"][0] = false; 119 VDir.Properties["AccessScript"][0] = true; //執行權限[純腳本] 120 //VDir.Properties["AuthNTLM"][0] = chkAuth; 121 VDir.Properties["EnableDefaultDoc"][0] = true; 122 VDir.Properties["EnableDirBrowsing"][0] = false; 123 VDir.Properties["DefaultDoc"][0] = "Default.aspx,Index.aspx,Index.asp"; //設置默認文檔,多值情況下中間用逗號分割 124 VDir.Properties["Path"][0] = Path; 125 VDir.Properties["AuthFlags"][0] = iAuth; 126 // 127 // NT doesn't support this property 128 // NT格式不支持這特性 129 // 130 if (!IISUnderNT) 131 { 132 VDir.Properties["AspEnableParentPaths"][0] = true; 133 } 134 // 135 // Set the changes 136 // 設置改變 137 // 138 VDir.CommitChanges(); 139 140 return true; 141 } 142 catch (Exception ex) 143 { 144 throw ex; 145 } 146 } 147 /// <summary> 148 /// 獲取VDir支持的所有屬性 149 /// </summary> 150 /// <returns></returns> 151 public string GetVDirPropertyName() 152 { 153 //System.DirectoryServices.DirectoryEntry VDir; 154 const String constIISWebSiteRoot = "IIS://localhost/W3SVC/1/ROOT/iKaoo"; 155 DirectoryEntry root = new DirectoryEntry(constIISWebSiteRoot); 156 string sOut = ""; 157 //下面的方法是得到所有屬性名稱的方法: 158 foreach (PropertyValueCollection pvc in root.Properties) 159 { 160 //Console.WriteLine(pvc.PropertyName); 161 sOut += pvc.PropertyName + ":" + pvc.Value.ToString() + "-----------"; 162 } 163 return sOut; 164 } 165 /// <summary> 166 /// 創建虛擬目錄 167 /// </summary> 168 /// <param name="sDirName">虛擬目錄程式名稱</param> 169 /// <param name="sPath">實體路徑</param> 170 /// <param name="sDefaultDoc">黙認首頁,多個名稱用逗號分隔</param> 171 /// <param name="iAuthFlags">設置目錄的安全性,0不允許匿名訪問,1為允許,2基本身份驗證,3允許匿名+基本身份驗證,4整合Windows驗證,5允許匿名+整合Windows驗證...更多請查閱MSDN</param> 172 /// <param name="sWebSiteNumber">Win2K,2K3支持多個網站,本次操作哪個網站,黙認網站為1</param> 173 /// <returns></returns> 174 public bool CreateVDir(string sDirName, string sPath, string sDefaultDoc, int iAuthFlags, string sWebSiteNumber) 175 { 176 try 177 { 178 String sIISWebSiteRoot = "IIS://localhost/W3SVC/" + sWebSiteNumber + "/ROOT"; 179 DirectoryEntry root = new DirectoryEntry(sIISWebSiteRoot); 180 foreach (System.DirectoryServices.DirectoryEntry v in root.Children) 181 { 182 if (v.Name == sDirName) 183 { 184 // Delete the specified virtual directory if it already exists 185 root.Invoke("Delete", new string[] { v.SchemaClassName, sDirName }); 186 root.CommitChanges(); 187 } 188 } 189 DirectoryEntry tbEntry = root.Children.Add(sDirName, root.SchemaClassName); 190 191 tbEntry.Properties["Path"][0] = sPath; 192 tbEntry.Invoke("AppCreate", true); 193 //tbEntry.Properties["AccessRead"][0] = true; 194 //tbEntry.Properties["ContentIndexed"][0] = true; 195 tbEntry.Properties["DefaultDoc"][0] = sDefaultDoc; 196 tbEntry.Properties["AppFriendlyName"][0] = sDirName; 197 //tbEntry.Properties["AccessScript"][0] = true; 198 //tbEntry.Properties["DontLog"][0] = true; 199 //tbEntry.Properties["AuthFlags"][0] = 0; 200 tbEntry.Properties["AuthFlags"][0] = iAuthFlags; 201 tbEntry.CommitChanges(); 202 return true; 203 } 204 catch (Exception ex) 205 { 206 throw ex; 207 } 208 } 209 210 } 211 212 } 213 調用DEMO: 214 private void button1_Click(object sender, EventArgs e) 215 { 216 if (new IISManager().CreateWebSite("localhost", "Vtest", "E:\\DOC", false, 1, 1, "localhost")) 217 lbInfo.Text = "Create Vtest OK"; 218 } 219 private void button2_Click(object sender, EventArgs e) 220 { 221 txtPN.Text = new IISManager().GetVDirPropertyName(); 222 } 223 private void button3_Click(object sender, EventArgs e) 224 { 225 if (new IISManager().CreateVDir("iKaoo", "E:\\DOC", "index.aspx,Default.aspx", 1, "1")) 226 lbInfo.Text = "Create iKaoo OK"; 227 }
同樣的方式,也可以對網站對屬性進行修改。
IIS的站點屬性(詳細內容,請查閱IIS幫助)
Read only properties of W3SVC/1/Root: // 只讀屬性
AppIsolated = 2 屬性指出應用程序是在進程內、進程外還是在進程池中運行。值 0 表示應用程序在進程內運行,值 1 表示進程外,值 2 表示進程池。
AppPackageID = 為事務提供 COM+ 應用程序標識符 (ID)。此 ID 在由組件服務管理的所有事務中使用。
AppPackageName = 為事務提供 COM+ 應用程序名。
AppRoot = /LM/W3SVC/1/ROOT 包含到應用程序根目錄的配置數據庫路徑。
Caption = 提供對象的一段簡短文本描述(一行字符串)。
Description = 提供對象的一段較長文本描述。
InstallDate = 表示安裝對象的時間。缺少值並不表示對象沒有安裝。
Name = W3SVC/1/ROOT 定義了用來識別對象的標簽。創建子類時,可以將 Name 屬性改寫為 Key 屬性。
Status = 表示對象當前狀態。各種可操作的和不可操作的狀態都可以被定義。可操作的狀態為“正常”、“已降級”和“預見故障”。“預見故障”表示一個組件可能運行正常但預計很快會出現故障。例如,啟用 SMART 的硬盤。還可指定不可操作的狀態。這些狀態為“錯誤”、“啟動”、“停止”和“服務”。后者(即“服務”)可用於磁盤鏡像過程、重新加載用戶權限列表或其他管理作業。並不是所有這類作業都聯機;所以,被管理的組件不是“正常”狀態或處於任何其他狀態。
Read/Write properties of W3SVC/1/Root: // 可讀/可寫
AccessExecute = False 值 true 表示不論文件類型是什么,文件或文件夾的內容都可以執行。
AccessFlags = 513 包含有用於配置文件訪問權限的標志
AccessNoPhysicalDir = False
AccessNoRemoteExecute = False 值 true 表示拒絕遠程請求執行應用程序;如果將 AccessExecute 屬性設置為 true,只有來自 IIS 服務器所在的相同計算機的請求才會成功。您不能將 AccessNoRemoteExecute 設置為 false 來啟用遠程請求,或將 AccessExecute 設置為 false 來禁止本地請求。
AccessNoRemoteRead = False 值 true 表示拒絕遠程請求查看文件;如果將 AccessRead 屬性設置為 true,只有來自 IIS 服務器所在的相同計算機的請求才會成功。您不能將 AccessNoRemoteRead 設置為 false 來啟用遠程請求,或將 AccessRead 設置為 false 來禁止本地請求。
AccessNoRemoteScript = False 值 true 表示拒絕遠程請求查看動態內容;如果將 AccessScript 屬性設置為 true,只有來自 IIS 服務器所在的相同計算機的請求才會成功。您不能將 AccessNoRemoteScript 設置為 false 來啟用遠程請求,或將 AccessScript 設置為 false 來禁止本地請求。
AccessNoRemoteWrite = False 值 true 表示拒絕遠程請求創建或更改文件;如果將 AccessWrite 屬性設置為 true,只有來自 IIS 服務器所在的相同計算機的請求才會成功。您不能將 AccessNoRemoteWrite 設置為 false 來啟用遠程請求,或將 AccessWrite 設置為 false 來禁止本地請求。
AccessRead = True 值 true 表示可通過 Microsoft Internet Explorer 讀取文件或文件夾的內容。
AccessScript = True 值 true 表示如果是腳本文件或靜態內容,則可以執行文件或文件夾的內容。值 false 只允許提供靜態文件,如 HTML 文件。
AccessSource = False 值 true 表示如果設置了讀取或寫入權限,則允許用戶訪問源代碼。源代碼包括 Microsoft? Active Server Pages (ASP) 應用程序中的腳本。
AccessSSL = False 值 true 表示文件訪問需要帶有或不帶有客戶端證書的 SSL 文件權限處理。
AccessSSL128 = False 值 true 表示文件訪問需要至少 128 位密鑰、帶有或不帶有客戶端證書的 SSL 文件權限處理。
AccessSSLFlags = 0 默認值 0 表示未設置任何 SSL 權限。
AccessSSLMapCert = False 值 true 表示 SSL 文件權限處理將客戶端證書映射到 Microsoft Windows? 操作系統的用戶帳戶上。要實現映射,必須將 AccessSSLNegotiateCert 屬性設置成 true。
AccessSSLNegotiateCert = False 值 true 表示 SSL 文件訪問處理從客戶端請求證書。值 false 表示如果客戶端沒有證書,仍可繼續訪問。如果服務器請求證書但證書不可用(即使也將 AccessSSLRequireCert 設成 true),某些版本的 Internet Explorer 將關閉連接。
AccessSSLRequireCert = False 值 true 表示 SSL 文件訪問處理從客戶端請求證書。如果客戶端沒有提供證書,連接會關閉。當使用 AccessSSLRequireCert 時,必須將 AccessSSLNegotiateCert 設成 true。
AccessWrite = False 值 true 表示允許用戶將文件及其相關屬性上載到服務器上已啟用的目錄中,或者更改可寫文件的內容。只有使用支持 HTTP 1.1 協議標准的 PUT 功能的瀏覽器,才能執行寫入操作。
AdminACLBin = 由 Microsoft? Exchange Server 使用
AnonymousPasswordSync = True 指出 IIS 是否應該為試圖訪問資源的匿名用戶處理用戶密碼。下表列出了該屬性行為的詳細說明:如果將 AnonymousPasswordSync 設置為 false,管理員必須手動設置匿名用戶密碼的 AnonymousUserPass 屬性;否則匿名訪問將無法正常工作。 如果將 AnonymousPasswordSync 設置為 true,將由 IIS 設置匿名用戶密碼。 如果將 AnonymousPasswordSync 設置為 true 並且配置數據庫屬性 AllowAnonymous 值為 false,則不允許任何用戶登錄到 FTP 服務器。
AnonymousUserName = IUSR_COMPUTERNAME 指定用來驗證匿名用戶的已注冊的本地用戶名。服務器將每個服務器操作與用戶名和密碼關聯起來。
AnonymousUserPass = XXXXXXXXXXXX 指定用來驗證匿名用戶的已注冊的本地用戶密碼。服務器將每個服務器操作與用戶名和密碼關聯起來。
AppAllowClientDebug = False 指定是否允許客戶端調試。該屬性與應用於服務器端調試的 AppAllowDebugging 無關。
AppAllowDebugging = False 指定是否允許在服務器上進行 ASP 調試。該屬性與應用於客戶端調試的 AppAllowClientDebug 屬性無關。
AppFriendlyName = 默認應用程序 軟件包或應用程序的用戶好記名稱
AppOopRecoverLimit = -1 進程外應用程序在出現故障后重新啟動的最大次數。服務器不會響應超出該范圍的組件請求。該屬性不適用於進程內運行的應用程序或擴展。
AppPoolId = ASP.NET V2.0 應用程序在其中路由的應用程序池
AppWamClsid = 為應用程序的 Web 應用程序管理 (WAM) 接口提供類 ID
AspAllowOutOfProcComponents = True 在 IIS 4.0 中,AspAllowOutOfProcComponents 屬性指定是否允許 ASP 腳本調用進程外組件,這些組件是在應用程序內啟動的可執行程序。在 IIS 5.0 中,該屬性已過時,並且屬性值將被忽略。但是,使用該屬性的腳本仍然可以正常運行。
AspAllowSessionState = True 啟用 ASP 應用程序會話狀態持續性。如果將該值設置為 true,那么服務器將為每個連接創建 Session 對象,可訪問會話狀態,允許會話存儲,出現 Session_OnStart 和 Session_OnEnd 事件,並且發送 ASPSessionID Cookie 到客戶端。如果將該值設置為 false,那么不允許狀態訪問和存儲,事件將不進行處理,並且也不發送 Cookie。
AspAppServiceFlags = 0 包含在 IIS 應用程序上啟用 COM+ 服務所必須要設置的標志
AspBufferingLimit = 4194304 設置 ASP 緩沖區的最大大小。如果啟動了響應緩沖,該屬性將控制在進行刷新前 ASP 頁面可以向響應緩沖區寫入的最大字節數
AspBufferingOn = True ASP 應用程序的輸出是否需要緩沖
AspCalcLineNumber = True ASP 是否計算和存儲已執行代碼的行號,以便在錯誤報告中提供
AspCodepage = 0 為應用程序指定默認的代碼頁
AspDiskTemplateCacheDirectory = %windir%\system32\inetsrv\ASP Comp 目錄的名稱,該目錄是 ASP 在存儲器內的緩存溢出后,用來將已編譯的 ASP 模板存儲到磁盤的目錄
AspEnableApplicationRestart = True 確定 ASP 應用程序能否自動重新啟動
AspEnableAspHtmlFallback = False 當由於請求隊列已滿而拒絕新的請求時,AspEnableAspHtmlFallback 屬性控制 ASP 的行為。將該屬性設置為 true,將導致發送與請求的 .asp 文件名稱類似的 .htm 文件(如果存在),而不是發送 .asp 文件。.htm 文件的命名約定是 .asp 文件名之后附加一個 _asp。例如,.asp 文件是 hello.asp,那么 .htm 文件應該是 hello_asp.htm。
AspEnableChunkedEncoding = True 指定是否為萬維網發布服務(WWW 服務)啟動 HTTP 1.1 chunked 傳輸編碼
AspEnableParentPaths = False 頁面是否允許當前目錄的相對路徑(使用 ..\ 表示法)。
AspEnableSxs = False 值 true 將啟動 COM+ 並排集合,該程序集允許 ASP 應用程序指定要使用哪個版本的系統 DLL 或傳統 COM 組件,例如 MDAC、MFS、MSVCRT、MSXML 等等。
AspEnableTracker = False 值 true 將啟動 COM+ 跟蹤器,管理員或開發人員可用其來調試 ASP 應用程序。
AspEnableTypelibCache = True 是否在服務器上緩存類型庫
AspErrorsToNTLog = False 是否將 IIS 腳本錯誤寫入到 Windows 事件日志中
AspExceptionCatchEnable = True 頁面是否捕獲組件產生的異常。如果設置為 false (或者禁用),那么 Microsoft 腳本調試程序工具將不捕捉所調試的組件發生的異常。
AspExecuteInMTA = 0 ASP 能夠在一個多線程單元 (MTA) 中運行其全部線程。如果 COM 組件主要是自由線程或雙線程組件,則將 ASP 線程作為 MTA 運行可顯著改善性能。默認情況下,AspExecuteInMTA 屬性設置為 0,這意味着 ASP 不在 MTA 中執行。在應用程序級別上將該屬性設置為 1 可以使 ASP 在 MTA 中運行。
AspKeepSessionIDSecure = 0 啟用 AspKeepSessionIDSecure 屬性后,它可以確保將 SessionID 作為安全 Cookie 發送(如果已在安全通道上分配的話)。
AspLCID = 2048 用程序指定默認的區域設置標識符 (LCID)。
AspLogErrorRequests = True 控制 Web 服務器是否將失敗的客戶請求寫入到 Windows 事件日志文件中
AspMaxDiskTemplateCacheFiles = 2000 指定存儲已編譯 ASP 模板的最大數量。存儲已編譯模板的目錄由 AspDiskTemplateCacheDirectory 屬性配置。
AspMaxRequestEntityAllowed = 204800 指定一個 ASP 請求的實體正文中允許的最多字節數。
AspPartitionID = COM+ 分區用於將 Web 應用程序隔離到其各自的 COM+ 分區。COM+ 分區保存不同的自定義 COM 組件的版本。將 AspPartitionID 屬性設置為 COM+ 分區的全局唯一標識符 (GUID)。同時,設置 AspAppServiceFlags 配置數據庫屬性的 AspUsePartition 標志。在應用程序級別設置這兩個屬性
AspProcessorThreadMax = 25 指定 IIS 可創建的每個處理器的最大工作線程數
AspQueueConnectionTestTime = 3 IIS 將所有的 ASP 請求放置到隊列中。如果請求在隊列中等待的時間比 AspQueueConnectionTestTime 屬性指定的時間(以秒為單位)長,則 ASP 將在執行請求前檢查確定客戶端是否仍是連接的。如果客戶端已斷開連接,則不處理該請求並且從隊列中刪除該請求。
AspQueueTimeout = -1 允許 ASP 腳本請求在隊列中等待的時間(以秒為單位)。無窮大表示為 -1。
AspRequestQueueMax = 3000 允許進入隊列的並發 ASP 請求的最大數目。在隊列占滿時,任何試圖請求 ASP 文件的客戶端瀏覽器都將收到 HTTP 500“服務器太忙”的錯誤。
AspRunOnEndAnonymously = True 指定了 SessionOnEnd 和 ApplicationOnEnd 全局 ASP 函數是否應該作為匿名用戶運行
AspScriptEngineCacheMax = 250 頁面將在內存中保持緩存的腳本引擎的最大數目
AspScriptErrorMessage = 處理 URL 時服務器出錯。請與系統管理員聯系。 特殊調試錯誤沒有被發送到客戶端時(如果將 AspScriptErrorSentToBrowser 設置成 false)將發送給瀏覽器的錯誤消息
AspScriptErrorSentToBrowser = True Web 服務器是否將調試細節(文件名、錯誤、行號、描述)寫到客戶端瀏覽器,並且記錄到 Windows 事件日志中
AspScriptFileCacheSize = 500 要緩存的預編譯腳本文件數。如果設置為 0,則不緩存任何腳本文件
AspScriptLanguage = VBScript 運行在 Web 服務器上的所有 ASP 應用程序的默認腳本語言
AspScriptTimeout = 90 AspScriptTimeout 屬性指定了在終止腳本和將事件寫入 Windows 事件日志之前,ASP 頁面允許的腳本運行時間的默認值(以秒為單位)。
AspSessionMax = -1 IIS 允許的最大並發會話數。當達到該限制時,如果客戶端試圖與 IIS 建立新連接,則客戶端將接收到錯誤信息(HTTP 500“服務器太忙”)。無窮大表示為 -1。
AspSessionTimeout = 20 完成最后的與 Session 對象相關的請求后,保留該對象的時間(以分鍾為單位)。
AspSxsName = 啟動並行 (SxS) 程序集。並行 (SxS) 程序集允許 ASP 應用程序指定要使用哪個版本的系統 DLL 或傳統 COM 組件,例如 MDAC、MFS、MSVCRT、MSXML 等。
AspTrackThreadingModel = False IIS 是否檢查應用程序創建的任意組件的線程模塊。
AspUsePartition = False 值 true 將啟動 COM+ 分區,可用其將 Web 應用程序隔離到各自的 COM+ 分區。COM+ 分區可擁有不同的自定義 COM 組件的版本。如果設置該標志,請同時設置 AspPartitionID 配置數據庫屬性。
AuthAdvNotifyDisable = True 禁用密碼到期預先通知
AuthAnonymous = True 指定匿名身份驗證作為可能的 Windows 驗證方案之一,返回給客戶端作為有效驗證方案。
AuthBasic = False 指定基本身份驗證作為可能的 Windows 驗證方案之一,返回給客戶端作為有效驗證方案。
AuthChangeDisable = True 禁止更改密碼
AuthChangeUnsecure = False 允許在不安全端口更改密碼
AuthChangeURL = /iisadmpwd/achg.asp 用戶輸入新密碼時被調用的 URL
AuthExpiredUnsecureURL = /iisadmpwd/aexp3.asp 用戶密碼到期時調用的 URL
AuthExpiredURL = /iisadmpwd/aexp.asp 用戶密碼到期時調用的 URL。將以安全的 (HTTPS) 方式調用它。
AuthFlags = 5 作為有效方案返回給客戶端的 Windows 驗證方案的設置
AuthMD5 = False 指定摘要式身份驗證和高級摘要式身份驗證作為可能的 Windows 驗證方案之一,返回給客戶端作為有效驗證方案。
AuthNotifyPwdExpUnsecureURL = /iisadmpwd/anot3.asp 包含一個特定的 URL:如果用戶的密碼在 PasswordExpirePreNotifyDays 中指定的天數前到期,則調用該 URL。
AuthNotifyPwdExpURL = /iisadmpwd/anot.asp 包含一個特定的 URL:如果用戶的密碼在 PasswordExpirePreNotifyDays 中指定的天數前到期,則調用該 URL。將以安全的 (HTTPS) 方式調用它。
AuthNTLM = True 指定集成 Windows 身份驗證(也稱作質詢/響應或 NTLM 驗證)作為可能的 Windows 驗證方案之一,返回給客戶端作為有效驗證方案。
AuthPassport = False true 的值表示啟用了 Microsoft? .NET Passport 身份驗證
AuthPersistence = 64 指定了使用 NTLM 驗證跨越連接上的請求時的驗證持久性
AuthPersistSingleRequest = True 將該標志設置成 true 指定驗證僅對一個連接上的單個請求持久。IIS 在每個請求的末尾重設驗證,並且在會話的下一個請求上強制執行重驗證。
AzEnable = False 用於虛擬目錄、應用程序,或配置數據庫中項相應的 URL 的 URL 授權。
AzImpersonationLevel = 0 用於應用程序的模擬行為,該模擬行為允許配置 Web 應用程序模擬客戶端用戶、IIS 工作進程,或工作進程的 IUSER_* 帳戶。
AzScopeName = 將虛擬目錄、應用程序或 URL 與作用域相關聯。如果沒有指定作用域或指定了空子符串,則使用 IIS 6.0 URL 授權的默認作用域。
AzStoreName = 授權管理器策略存儲與虛擬目錄、應用程序或 URL 相關聯。
CacheControlCustom = 指定了自定義 HTTP 1.1 緩存控制指令。
CacheControlMaxAge = 0 指定了 HTTP 1.1 緩存控制最大時間值。
CacheControlNoCache = False 保護緩存內容的 HTTP 1.1 指令
CacheISAPI = True 在第一次使用 ISAPI 擴展后是否在內存中進行緩存。
Caption = 提供對象的一段簡短文本描述(一行字符串)。
CGITimeout = 300 指定 CGI 應用程序超時(以秒為單位)。
ContentIndexed = True 指定安裝的目錄索引程序是否應該檢索該目錄樹下的內容。
CreateCGIWithNewConsole = False 指示 CGI 應用程序是否在自己的控制台上運行。
CreateProcessAsUser = True 是在系統環境中創建 CGI 進程還是在請求用戶環境中創建 CGI 進程。
DefaultDoc = index.aspx,default.aspx 包含一個或多個默認文檔的文件名,如果在客戶端的請求中不包含文件名,將把默認文檔的文件名返回給客戶端。
DefaultDocFooter = 附加到返回到客戶端的 HTML 文件的自定義頁腳(頁腳並不附加到 ASP 文件)。
DefaultLogonDomain = 服務器用來對用戶進行身份驗證的默認域(在 UserIsolationMode = 2 的 Web 宿主方案中)。
Description = 提供對象的一段較長文本描述。
DirBrowseFlags = 1073741886 可以提供多少目錄和文件信息(如果啟用瀏覽)以及目錄中是否包含默認頁的標記。
DirBrowseShowDate = True 設置為 true 時,瀏覽目錄時將顯示日期信息。
DirBrowseShowExtension = True 設置為 true 時,瀏覽目錄時將顯示文件擴展名。
DirBrowseShowLongDate = True 設置為 true 時,顯示目錄時將在擴展格式中顯示日期信息。
DirBrowseShowSize = True 設置為 true 時,瀏覽目錄時將顯示文件大小信息。
DirBrowseShowTime = True 設置為 true 時,顯示目錄時將顯示文件時間信息。
DisableStaticFileCache = False 目錄的靜態文件緩存
DoDynamicCompression = False 與 HcDoDynamicCompression 屬性相同。
DontLog = False 是否將客戶端的請求寫入日志文件。
DoStaticCompression = False 與 HcDoStaticCompression 屬性相同。
EnableDefaultDoc = True 設置為 true 時,瀏覽目錄時系統會加載該目錄的默認文檔(由 De, faultDoc 屬性指定)。
EnableDirBrowsing = False 設置為 true 時,將啟用目錄瀏覽。
EnableDocFooter = False 啟用或禁用由 DefaultDocFooter 屬性指定的自定義頁腳。
EnableReverseDns = False 啟用或禁用萬維網發布服務(WWW 服務)的反向域名服務器 (DNS) 查找。
FrontPageWeb = True 服務器實例是否由 Microsoft? FrontPage? 處理