共用方式為


ModulesSection 類別

表示組態檔中的 modules 區段。

Syntax

class ModulesSection : ConfigurationSectionWithCollection  

方法

下表列出 類別所 ModulesSection 公開的方法。

名稱 描述
加入 (繼承自 ConfigurationSectionWithCollection.)
清除 (繼承自 ConfigurationSectionWithCollection。)
Get (繼承自 ConfigurationSectionWithCollection。)
GetAllowDefinition (繼承自 ConfigurationSection.)
GetAllowLocation (繼承自 ConfigurationSection。)
移除 (繼承自 ConfigurationSectionWithCollection。)
RevertToParent (繼承自 ConfigurationSection。)
SetAllowDefinition (繼承自 ConfigurationSection。)
SetAllowLocation (繼承自 ConfigurationSection。)

屬性

下表列出 類別所 ModulesSection 公開的屬性。

名稱 描述
Location (繼承自 ConfigurationSection .) 索引鍵屬性。
Modules 讀取/寫入 ModuleAction 值的陣列。
Path (繼承自 ConfigurationSection .) 索引鍵屬性。
RunAllManagedModulesForAllRequests 讀取/寫入 boolean 值。 true 如果針對每個要求執行所有受控模組,則為 ;否則為 false 。 預設值為 false
SectionInformation (繼承自 ConfigurationSection。)

子類別

這個類別不包含子類別。

備註

這個類別包含全域模組,這些模組是在 Web 服務器上在特定層級啟用,以及同時在相同層級執行要求工作的 Managed 模組。

範例

下列範例會在 ApplicationHost.config 檔案的 區段中顯示原生和 Managed 模組 <modules>

' Connect to the WMI WebAdministration namespace.  
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")  
  
' Get the <modules> section.  
Set oSection = oWebAdmin.Get( _  
    "ModulesSection.Path='MACHINE/WEBROOT/APPHOST/',Location=''")  
  
' Display the native modules.  
WScript.Echo "---------- Native -------------"  
For Each oModule In oSection.Modules  
    If oModule.Type = "" Then  
        WScript.Echo "   " & oModule.Name  
    End If  
Next  
WScript.Echo   
  
' Display the managed modules.  
WScript.Echo "---------- Managed ----------"  
For Each oModule In oSection.Modules  
    If oModule.Type <> "" Then  
        If Len(oModule.Name) < 12 Then  
            WScript.Echo "   " & oModule.Name & _  
                vbTab & vbTab & vbTab & "[" & oModule.Type & "]"  
        ElseIf Len(oModule.Name) < 20 Then  
            WScript.Echo "   " & oModule.Name & _  
                vbTab & vbTab & "[" & oModule.Type & "]"  
        Else   
            WScript.Echo "   " & oModule.Name & _  
                vbTab & "[" & oModule.Type & "]"  
        End If  
    End If  
Next  

繼承階層架構

ConfigurationSection

ConfigurationSectionWithCollection

ModulesSection

規格需求

類型 描述
Client - Windows Vista 上的 IIS 7.0
- Windows 7 上的 IIS 7.5
- Windows 8 上的 IIS 8.0
- Windows 10上的 IIS 10.0
伺服器 - Windows Server 2008 上的 IIS 7.0
- Windows Server 2008 R2 上的 IIS 7.5
- Windows Server 2012 上的 IIS 8.0
- Windows Server 2012 R2 上的 IIS 8.5
- Windows Server 2016上的 IIS 10.0
產品 - IIS 7.0、IIS 7.5、IIS 8.0、IIS 8.5、IIS 10.0
MOF 檔案 WebAdministration.mof

另請參閱

ConfigurationSectionWithCollection 類別
GlobalModuleElement 類別
GlobalModulesSection 類別
ModuleAction 類別