DirectoryEntry root = new DirectoryEntry(@"IIS://localhost/W3SVC");string PInfo = ""; foreach (string elmentName in root.Properties.PropertyNames){ PropertyValueCollection valueCollection = root.Properties[elmentName]; for (int i = 0; i < valueCollection.Count; i++) { PInfo += elmentName + "[ " + i.ToString() + "] = " + valueCollection[i].ToString() + "\r\n"; }}
PInfo的结果是:
AccessFlags[ 0] = 513AllowKeepAlive[ 0] = TrueAppAllowClientDebug[ 0] = FalseAppAllowDebugging[ 0] = FalseAspAllowOutOfProcComponents[ 0] = TrueAspAllowSessionState[ 0] = TrueAspAppServiceFlags[ 0] = 0AspBufferingLimit[ 0] = 4194304AspBufferingOn[ 0] = TrueAspCalcLineNumber[ 0] = TrueAspCodepage[ 0] = 0AspEnableApplicationRestart[ 0] = TrueAspEnableAspHtmlFallback[ 0] = FalseAspEnableChunkedEncoding[ 0] = TrueAspEnableParentPaths[ 0] = FalseAspEnableTypelibCache[ 0] = TrueAspErrorsToNTLog[ 0] = FalseAspExceptionCatchEnable[ 0] = TrueAspExecuteInMTA[ 0] = 0AspKeepSessionIDSecure[ 0] = 0AspLCID[ 0] = 2048AspLogErrorRequests[ 0] = TrueAspMaxDiskTemplateCacheFiles[ 0] = 2000AspMaxRequestEntityAllowed[ 0] = 204800AspProcessorThreadMax[ 0] = 25AspQueueConnectionTestTime[ 0] = 3AspQueueTimeout[ 0] = -1AspRequestQueueMax[ 0] = 3000AspRunOnEndAnonymously[ 0] = TrueAspScriptEngineCacheMax[ 0] = 250AspScriptErrorSentToBrowser[ 0] = TrueAspScriptFileCacheSize[ 0] = 500AspScriptTimeout[ 0] = 90AspSessionMax[ 0] = -1AspSessionTimeout[ 0] = 20AspTrackThreadingModel[ 0] = FalseAuthFlags[ 0] = 1CacheISAPI[ 0] = TrueCentralBinaryLoggingEnabled[ 0] = FalseCGITimeout[ 0] = 300ConnectionTimeout[ 0] = 120ContentIndexed[ 0] = TrueDirBrowseFlags[ 0] = 1073741886DownlevelAdminInstance[ 0] = 1IIs5IsolationModeEnabled[ 0] = FalseLogExtFileFlags[ 0] = 2199519LogFilePeriod[ 0] = 1LogFileTruncateSize[ 0] = 20971520LogInUTF8[ 0] = FalseLogType[ 0] = 1MaxConnections[ 0] = -1MaxGlobalBandwidth[ 0] = -1MinFileBytesPerSec[ 0] = 240PasswordChangeFlags[ 0] = 6AnonymousUserName[ 0] = IUSR_SVCTAG-FT9G93XAnonymousUserPass[ 0] = UP-aq0|5076u(~AppPoolId[ 0] = DefaultAppPoolAspScriptErrorMessage[ 0] = 处理 URL 时服务器出错。请与系统管理员联系。AspScriptLanguage[ 0] = VBScriptAuthChangeURL[ 0] = /iisadmpwd/achg.aspAuthExpiredUnsecureURL[ 0] = /iisadmpwd/aexp3.aspAuthExpiredURL[ 0] = /iisadmpwd/aexp.aspAuthNotifyPwdExpUnsecureURL[ 0] = /iisadmpwd/anot3.aspAuthNotifyPwdExpURL[ 0] = /iisadmpwd/anot.aspDefaultDoc[ 0] = index.html,index.htm,Default.aspx,index.aspx,Default.htm,Default.aspKeyType[ 0] = IIsWebServiceLogOdbcDataSource[ 0] = HTTPLOGLogOdbcPassword[ 0] = sqllogLogOdbcTableName[ 0] = InternetLogLogOdbcUserName[ 0] = InternetAdminLogPluginClsid[ 0] = {FF160663-DE82-11CF-BC0A-00AA006111E0}WAMUserName[ 0] = IWAM_SVCTAG-FT9G93XWAMUserPass[ 0] = 0R735F;wQ_/:8QAspDiskTemplateCacheDirectory[ 0] = %windir%\system32\inetsrv\ASP Compiled TemplatesLogFileDirectory[ 0] = C:\WINDOWS\system32\LogFilesApplicationDependencies[ 0] = Active Server Pages;ASPApplicationDependencies[ 1] = Internet 数据连接器;HTTPODBCApplicationDependencies[ 2] = 在服务器端的包含文件;SSINCApplicationDependencies[ 3] = WebDAV;WEBDAVApplicationDependencies[ 4] = ASP.NET v1.1.4322;ASP.NET v1.1.4322ApplicationDependencies[ 5] = ASP.NET v4.0.30319;ASP.NET v4.0.30319ApplicationDependencies[ 6] = ASP.NET v2.0.50727;ASP.NET v2.0.50727HttpCustomHeaders[ 0] = X-Powered-By: ASP.NETHttpErrors[ 0] = 400,*,FILE,C:\WINDOWS\help\iisHelp\common\400.htmHttpErrors[ 1] = 401,1,FILE,C:\WINDOWS\help\iisHelp\common\401-1.htmHttpErrors[ 2] = 401,2,FILE,C:\WINDOWS\help\iisHelp\common\401-2.htmHttpErrors[ 3] = 401,3,FILE,C:\WINDOWS\help\iisHelp\common\401-3.htmHttpErrors[ 4] = 401,4,FILE,C:\WINDOWS\help\iisHelp\common\401-4.htmHttpErrors[ 5] = 401,5,FILE,C:\WINDOWS\help\iisHelp\common\401-5.htmHttpErrors[ 6] = 401,7,FILE,C:\WINDOWS\help\iisHelp\common\401-1.htmHttpErrors[ 7] = 403,1,FILE,C:\WINDOWS\help\iisHelp\common\403-1.htmHttpErrors[ 8] = 403,2,FILE,C:\WINDOWS\help\iisHelp\common\403-2.htmHttpErrors[ 9] = 403,3,FILE,C:\WINDOWS\help\iisHelp\common\403-3.htmHttpErrors[ 10] = 403,4,FILE,C:\WINDOWS\help\iisHelp\common\403-4.htmHttpErrors[ 11] = 403,5,FILE,C:\WINDOWS\help\iisHelp\common\403-5.htmHttpErrors[ 12] = 403,6,FILE,C:\WINDOWS\help\iisHelp\common\403-6.htmHttpErrors[ 13] = 403,7,FILE,C:\WINDOWS\help\iisHelp\common\403-7.htmHttpErrors[ 14] = 403,8,FILE,C:\WINDOWS\help\iisHelp\common\403-8.htmHttpErrors[ 15] = 403,9,FILE,C:\WINDOWS\help\iisHelp\common\403-9.htmHttpErrors[ 16] = 403,10,FILE,C:\WINDOWS\help\iisHelp\common\403-10.htmHttpErrors[ 17] = 403,11,FILE,C:\WINDOWS\help\iisHelp\common\403-11.htmHttpErrors[ 18] = 403,12,FILE,C:\WINDOWS\help\iisHelp\common\403-12.htmHttpErrors[ 19] = 403,13,FILE,C:\WINDOWS\help\iisHelp\common\403-13.htmHttpErrors[ 20] = 403,15,FILE,C:\WINDOWS\help\iisHelp\common\403-15.htmHttpErrors[ 21] = 403,16,FILE,C:\WINDOWS\help\iisHelp\common\403-16.htmHttpErrors[ 22] = 403,17,FILE,C:\WINDOWS\help\iisHelp\common\403-17.htmHttpErrors[ 23] = 403,18,FILE,C:\WINDOWS\help\iisHelp\common\403.htmHttpErrors[ 24] = 403,19,FILE,C:\WINDOWS\help\iisHelp\common\403.htmHttpErrors[ 25] = 403,20,FILE,C:\WINDOWS\help\iisHelp\common\403-20.htmHttpErrors[ 26] = 404,*,FILE,C:\WINDOWS\help\iisHelp\common\404b.htmHttpErrors[ 27] = 404,2,FILE,C:\WINDOWS\help\iisHelp\common\404b.htmHttpErrors[ 28] = 404,3,FILE,C:\WINDOWS\help\iisHelp\common\404b.htmHttpErrors[ 29] = 405,*,FILE,C:\WINDOWS\help\iisHelp\common\405.htmHttpErrors[ 30] = 406,*,FILE,C:\WINDOWS\help\iisHelp\common\406.htmHttpErrors[ 31] = 407,*,FILE,C:\WINDOWS\help\iisHelp\common\407.htmHttpErrors[ 32] = 412,*,FILE,C:\WINDOWS\help\iisHelp\common\412.htmHttpErrors[ 33] = 414,*,FILE,C:\WINDOWS\help\iisHelp\common\414.htmHttpErrors[ 34] = 415,*,FILE,C:\WINDOWS\help\iisHelp\common\415.htmHttpErrors[ 35] = 500,12,FILE,C:\WINDOWS\help\iisHelp\common\500-12.htmHttpErrors[ 36] = 500,13,FILE,C:\WINDOWS\help\iisHelp\common\500-13.htmHttpErrors[ 37] = 500,15,FILE,C:\WINDOWS\help\iisHelp\common\500-15.htmHttpErrors[ 38] = 500,16,FILE,C:\WINDOWS\help\iisHelp\common\500.htmHttpErrors[ 39] = 500,17,FILE,C:\WINDOWS\help\iisHelp\common\500.htmHttpErrors[ 40] = 500,18,FILE,C:\WINDOWS\help\iisHelp\common\500.htmHttpErrors[ 41] = 500,19,FILE,C:\WINDOWS\help\iisHelp\common\500.htmInProcessIsapiApps[ 0] = C:\WINDOWS\system32\inetsrv\httpext.dllInProcessIsapiApps[ 1] = C:\WINDOWS\system32\inetsrv\httpodbc.dllInProcessIsapiApps[ 2] = C:\WINDOWS\system32\inetsrv\ssinc.dllInProcessIsapiApps[ 3] = C:\WINDOWS\system32\msw3prt.dllInProcessIsapiApps[ 4] = C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dllInProcessIsapiApps[ 5] = C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dllInProcessIsapiApps[ 6] = C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dllMimeMap[ 0] = System.__ComObjectMimeMap[ 1] = System.__ComObjectMimeMap[ 2] = System.__ComObjectMimeMap[ 3] = System.__ComObjectMimeMap[ 4] = System.__ComObjectMimeMap[ 5] = System.__ComObjectMimeMap[ 6] = System.__ComObjectScriptMaps[ 0] = .asp,C:\WINDOWS\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACEScriptMaps[ 1] = .cer,C:\WINDOWS\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACEScriptMaps[ 2] = .cdx,C:\WINDOWS\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACEScriptMaps[ 3] = .asa,C:\WINDOWS\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACEScriptMaps[ 4] = .idc,C:\WINDOWS\system32\inetsrv\httpodbc.dll,5,GET,POSTScriptMaps[ 5] = .shtm,C:\WINDOWS\system32\inetsrv\ssinc.dll,5,GET,POSTScriptMaps[ 6] = .shtml,C:\WINDOWS\system32\inetsrv\ssinc.dll,5,GET,POSTScriptMaps[ 7] = .stm,C:\WINDOWS\system32\inetsrv\ssinc.dll,5,GET,POSTScriptMaps[ 8] = .asax,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUGScriptMaps[ 9] = .ascx,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUGScriptMaps[ 10] = .ashx,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUGScriptMaps[ 11] = .asmx,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUGScriptMaps[ 12] = .aspx,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUGScriptMaps[ 13] = .axd,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUGScriptMaps[ 14] = .vsdisco,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUGScriptMaps[ 15] = .rem,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUGScriptMaps[ 16] = .soap,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUGScriptMaps[ 17] = .config,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUGScriptMaps[ 18] = .cs,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUGScriptMaps[ 19] = .csproj,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUGScriptMaps[ 20] = .vb,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUGScriptMaps[ 21] = .vbproj,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUGScriptMaps[ 22] = .webinfo,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUGScriptMaps[ 23] = .licx,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUGScriptMaps[ 24] = .resx,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUGScriptMaps[ 25] = .resources,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUGWebSvcExtRestrictionList[ 0] = 1,C:\WINDOWS\system32\inetsrv\httpodbc.dll,0,HTTPODBC,Internet 数据连接器WebSvcExtRestrictionList[ 1] = 1,C:\WINDOWS\system32\inetsrv\ssinc.dll,0,SSINC,在服务器端的包含文件WebSvcExtRestrictionList[ 2] = 1,C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll,0,ASP.NET v4.0.30319,ASP.NET v4.0.30319WebSvcExtRestrictionList[ 3] = 1,C:\WINDOWS\system32\inetsrv\asp.dll,0,ASP,Active Server PagesWebSvcExtRestrictionList[ 4] = 1,C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,0,ASP.NET v2.0.50727,ASP.NET v2.0.50727WebSvcExtRestrictionList[ 5] = 0,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,0,ASP.NET v1.1.4322,ASP.NET v1.1.4322WebSvcExtRestrictionList[ 6] = 0,*.exeWebSvcExtRestrictionList[ 7] = 1,C:\WINDOWS\system32\inetsrv\httpext.dll,0,WEBDAV,WebDAVWebSvcExtRestrictionList[ 8] = 0,*.dllMaxBandwidth[ 0] = -1AdminACL[ 0] = System.__ComObject