日期:2015-7-6 浏览次数:2207次

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]   = 513
AllowKeepAlive[ 0]   = True
AppAllowClientDebug[ 0]   = False
AppAllowDebugging[ 0]   = False
AspAllowOutOfProcComponents[ 0]   = True
AspAllowSessionState[ 0]   = True
AspAppServiceFlags[ 0]   = 0
AspBufferingLimit[ 0]   = 4194304
AspBufferingOn[ 0]   = True
AspCalcLineNumber[ 0]   = True
AspCodepage[ 0]   = 0
AspEnableApplicationRestart[ 0]   = True
AspEnableAspHtmlFallback[ 0]   = False
AspEnableChunkedEncoding[ 0]   = True
AspEnableParentPaths[ 0]   = False
AspEnableTypelibCache[ 0]   = True
AspErrorsToNTLog[ 0]   = False
AspExceptionCatchEnable[ 0]   = True
AspExecuteInMTA[ 0]   = 0
AspKeepSessionIDSecure[ 0]   = 0
AspLCID[ 0]   = 2048
AspLogErrorRequests[ 0]   = True
AspMaxDiskTemplateCacheFiles[ 0]   = 2000
AspMaxRequestEntityAllowed[ 0]   = 204800
AspProcessorThreadMax[ 0]   = 25
AspQueueConnectionTestTime[ 0]   = 3
AspQueueTimeout[ 0]   = -1
AspRequestQueueMax[ 0]   = 3000
AspRunOnEndAnonymously[ 0]   = True
AspScriptEngineCacheMax[ 0]   = 250
AspScriptErrorSentToBrowser[ 0]   = True
AspScriptFileCacheSize[ 0]   = 500
AspScriptTimeout[ 0]   = 90
AspSessionMax[ 0]   = -1
AspSessionTimeout[ 0]   = 20
AspTrackThreadingModel[ 0]   = False
AuthFlags[ 0]   = 1
CacheISAPI[ 0]   = True
CentralBinaryLoggingEnabled[ 0]   = False
CGITimeout[ 0]   = 300
ConnectionTimeout[ 0]   = 120
ContentIndexed[ 0]   = True
DirBrowseFlags[ 0]   = 1073741886
DownlevelAdminInstance[ 0]   = 1
IIs5IsolationModeEnabled[ 0]   = False
LogExtFileFlags[ 0]   = 2199519
LogFilePeriod[ 0]   = 1
LogFileTruncateSize[ 0]   = 20971520
LogInUTF8[ 0]   = False
LogType[ 0]   = 1
MaxConnections[ 0]   = -1
MaxGlobalBandwidth[ 0]   = -1
MinFileBytesPerSec[ 0]   = 240
PasswordChangeFlags[ 0]   = 6
AnonymousUserName[ 0]   = IUSR_SVCTAG-FT9G93X
AnonymousUserPass[ 0]   = UP-aq0|5076u(~
AppPoolId[ 0]   = DefaultAppPool
AspScriptErrorMessage[ 0]   = 处理 URL 时服务器出错。请与系统管理员联系。
AspScriptLanguage[ 0]   = VBScript
AuthChangeURL[ 0]   = /iisadmpwd/achg.asp
AuthExpiredUnsecureURL[ 0]   = /iisadmpwd/aexp3.asp
AuthExpiredURL[ 0]   = /iisadmpwd/aexp.asp
AuthNotifyPwdExpUnsecureURL[ 0]   = /iisadmpwd/anot3.asp
AuthNotifyPwdExpURL[ 0]   = /iisadmpwd/anot.asp
DefaultDoc[ 0]   = index.html,index.htm,Default.aspx,index.aspx,Default.htm,Default.asp
KeyType[ 0]   = IIsWebService
LogOdbcDataSource[ 0]   = HTTPLOG
LogOdbcPassword[ 0]   = sqllog
LogOdbcTableName[ 0]   = InternetLog
LogOdbcUserName[ 0]   = InternetAdmin
LogPluginClsid[ 0]   = {FF160663-DE82-11CF-BC0A-00AA006111E0}
WAMUserName[ 0]   = IWAM_SVCTAG-FT9G93X
WAMUserPass[ 0]   = 0R735F;wQ_/:8Q
AspDiskTemplateCacheDirectory[ 0]   = %windir%\system32\inetsrv\ASP Compiled Templates
LogFileDirectory[ 0]   = C:\WINDOWS\system32\LogFiles
ApplicationDependencies[ 0]   = Active Server Pages;ASP
ApplicationDependencies[ 1]   = Internet 数据连接器;HTTPODBC
ApplicationDependencies[ 2]   = 在服务器端的包含文件;SSINC
ApplicationDependencies[ 3]   = WebDAV;WEBDAV
ApplicationDependencies[ 4]   = ASP.NET v1.1.4322;ASP.NET v1.1.4322
ApplicationDependencies[ 5]   = ASP.NET v4.0.30319;ASP.NET v4.0.30319
ApplicationDependencies[ 6]   = ASP.NET v2.0.50727;ASP.NET v2.0.50727
HttpCustomHeaders[ 0]   = X-Powered-By: ASP.NET
HttpErrors[ 0]   = 400,*,FILE,C:\WINDOWS\help\iisHelp\common\400.htm
HttpErrors[ 1]   = 401,1,FILE,C:\WINDOWS\help\iisHelp\common\401-1.htm
HttpErrors[ 2]   = 401,2,FILE,C:\WINDOWS\help\iisHelp\common\401-2.htm
HttpErrors[ 3]   = 401,3,FILE,C:\WINDOWS\help\iisHelp\common\401-3.htm
HttpErrors[ 4]   = 401,4,FILE,C:\WINDOWS\help\iisHelp\common\401-4.htm
HttpErrors[ 5]   = 401,5,FILE,C:\WINDOWS\help\iisHelp\common\401-5.htm
HttpErrors[ 6]   = 401,7,FILE,C:\WINDOWS\help\iisHelp\common\401-1.htm
HttpErrors[ 7]   = 403,1,FILE,C:\WINDOWS\help\iisHelp\common\403-1.htm
HttpErrors[ 8]   = 403,2,FILE,C:\WINDOWS\help\iisHelp\common\403-2.htm
HttpErrors[ 9]   = 403,3,FILE,C:\WINDOWS\help\iisHelp\common\403-3.htm
HttpErrors[ 10]   = 403,4,FILE,C:\WINDOWS\help\iisHelp\common\403-4.htm
HttpErrors[ 11]   = 403,5,FILE,C:\WINDOWS\help\iisHelp\common\403-5.htm
HttpErrors[ 12]   = 403,6,FILE,C:\WINDOWS\help\iisHelp\common\403-6.htm
HttpErrors[ 13]   = 403,7,FILE,C:\WINDOWS\help\iisHelp\common\403-7.htm
HttpErrors[ 14]   = 403,8,FILE,C:\WINDOWS\help\iisHelp\common\403-8.htm
HttpErrors[ 15]   = 403,9,FILE,C:\WINDOWS\help\iisHelp\common\403-9.htm
HttpErrors[ 16]   = 403,10,FILE,C:\WINDOWS\help\iisHelp\common\403-10.htm
HttpErrors[ 17]   = 403,11,FILE,C:\WINDOWS\help\iisHelp\common\403-11.htm
HttpErrors[ 18]   = 403,12,FILE,C:\WINDOWS\help\iisHelp\common\403-12.htm
HttpErrors[ 19]   = 403,13,FILE,C:\WINDOWS\help\iisHelp\common\403-13.htm
HttpErrors[ 20]   = 403,15,FILE,C:\WINDOWS\help\iisHelp\common\403-15.htm
HttpErrors[ 21]   = 403,16,FILE,C:\WINDOWS\help\iisHelp\common\403-16.htm
HttpErrors[ 22]   = 403,17,FILE,C:\WINDOWS\help\iisHelp\common\403-17.htm
HttpErrors[ 23]   = 403,18,FILE,C:\WINDOWS\help\iisHelp\common\403.htm
HttpErrors[ 24]   = 403,19,FILE,C:\WINDOWS\help\iisHelp\common\403.htm
HttpErrors[ 25]   = 403,20,FILE,C:\WINDOWS\help\iisHelp\common\403-20.htm
HttpErrors[ 26]   = 404,*,FILE,C:\WINDOWS\help\iisHelp\common\404b.htm
HttpErrors[ 27]   = 404,2,FILE,C:\WINDOWS\help\iisHelp\common\404b.htm
HttpErrors[ 28]   = 404,3,FILE,C:\WINDOWS\help\iisHelp\common\404b.htm
HttpErrors[ 29]   = 405,*,FILE,C:\WINDOWS\help\iisHelp\common\405.htm
HttpErrors[ 30]   = 406,*,FILE,C:\WINDOWS\help\iisHelp\common\406.htm
HttpErrors[ 31]   = 407,*,FILE,C:\WINDOWS\help\iisHelp\common\407.htm
HttpErrors[ 32]   = 412,*,FILE,C:\WINDOWS\help\iisHelp\common\412.htm
HttpErrors[ 33]   = 414,*,FILE,C:\WINDOWS\help\iisHelp\common\414.htm
HttpErrors[ 34]   = 415,*,FILE,C:\WINDOWS\help\iisHelp\common\415.htm
HttpErrors[ 35]   = 500,12,FILE,C:\WINDOWS\help\iisHelp\common\500-12.htm
HttpErrors[ 36]   = 500,13,FILE,C:\WINDOWS\help\iisHelp\common\500-13.htm
HttpErrors[ 37]   = 500,15,FILE,C:\WINDOWS\help\iisHelp\common\500-15.htm
HttpErrors[ 38]   = 500,16,FILE,C:\WINDOWS\help\iisHelp\common\500.htm
HttpErrors[ 39]   = 500,17,FILE,C:\WINDOWS\help\iisHelp\common\500.htm
HttpErrors[ 40]   = 500,18,FILE,C:\WINDOWS\help\iisHelp\common\500.htm
HttpErrors[ 41]   = 500,19,FILE,C:\WINDOWS\help\iisHelp\common\500.htm
InProcessIsapiApps[ 0]   = C:\WINDOWS\system32\inetsrv\httpext.dll
InProcessIsapiApps[ 1]   = C:\WINDOWS\system32\inetsrv\httpodbc.dll
InProcessIsapiApps[ 2]   = C:\WINDOWS\system32\inetsrv\ssinc.dll
InProcessIsapiApps[ 3]   = C:\WINDOWS\system32\msw3prt.dll
InProcessIsapiApps[ 4]   = C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll
InProcessIsapiApps[ 5]   = C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
InProcessIsapiApps[ 6]   = C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll
MimeMap[ 0]   = System.__ComObject
MimeMap[ 1]   = System.__ComObject
MimeMap[ 2]   = System.__ComObject
MimeMap[ 3]   = System.__ComObject
MimeMap[ 4]   = System.__ComObject
MimeMap[ 5]   = System.__ComObject
MimeMap[ 6]   = System.__ComObject
ScriptMaps[ 0]   = .asp,C:\WINDOWS\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE
ScriptMaps[ 1]   = .cer,C:\WINDOWS\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE
ScriptMaps[ 2]   = .cdx,C:\WINDOWS\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE
ScriptMaps[ 3]   = .asa,C:\WINDOWS\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE
ScriptMaps[ 4]   = .idc,C:\WINDOWS\system32\inetsrv\httpodbc.dll,5,GET,POST
ScriptMaps[ 5]   = .shtm,C:\WINDOWS\system32\inetsrv\ssinc.dll,5,GET,POST
ScriptMaps[ 6]   = .shtml,C:\WINDOWS\system32\inetsrv\ssinc.dll,5,GET,POST
ScriptMaps[ 7]   = .stm,C:\WINDOWS\system32\inetsrv\ssinc.dll,5,GET,POST
ScriptMaps[ 8]   = .asax,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
ScriptMaps[ 9]   = .ascx,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
ScriptMaps[ 10]   = .ashx,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
ScriptMaps[ 11]   = .asmx,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
ScriptMaps[ 12]   = .aspx,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
ScriptMaps[ 13]   = .axd,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
ScriptMaps[ 14]   = .vsdisco,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
ScriptMaps[ 15]   = .rem,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
ScriptMaps[ 16]   = .soap,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
ScriptMaps[ 17]   = .config,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
ScriptMaps[ 18]   = .cs,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
ScriptMaps[ 19]   = .csproj,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
ScriptMaps[ 20]   = .vb,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
ScriptMaps[ 21]   = .vbproj,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
ScriptMaps[ 22]   = .webinfo,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
ScriptMaps[ 23]   = .licx,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
ScriptMaps[ 24]   = .resx,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
ScriptMaps[ 25]   = .resources,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
WebSvcExtRestrictionList[ 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.30319
WebSvcExtRestrictionList[ 3]   = 1,C:\WINDOWS\system32\inetsrv\asp.dll,0,ASP,Active Server Pages
WebSvcExtRestrictionList[ 4]   = 1,C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,0,ASP.NET v2.0.50727,ASP.NET v2.0.50727
WebSvcExtRestrictionList[ 5]   = 0,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,0,ASP.NET v1.1.4322,ASP.NET v1.1.4322
WebSvcExtRestrictionList[ 6]   = 0,*.exe
WebSvcExtRestrictionList[ 7]   = 1,C:\WINDOWS\system32\inetsrv\httpext.dll,0,WEBDAV,WebDAV
WebSvcExtRestrictionList[ 8]   = 0,*.dll
MaxBandwidth[ 0]   = -1
AdminACL[ 0]   = System.__ComObject