Internet Information Services (IIS) 8 可讓開發人員輕鬆設定原生與受管理的程式碼模組,這些模組負責處理網頁伺服器發出的要求。為讓工作者處理序能夠將它們載入,必須正確設定模組。在正確的模組組態中,模組必須具有唯一名稱,以及一個有效類型或路徑。受管理模組可指定是否只有對 ASP.NET 應用程式或對受管理處理常式的要求應呼叫這些模組。指定之後,此設定便可將效能最佳化。
修正模組的註冊
在 IIS8 環境中,模組是可訂閱伺服器事件的邏輯實體。Web 伺服器已設定為在伺服器啟動時載入模組。伺服器在啟動期間會要求模組註冊其感興趣的事件。模組實作會負責為模組註冊其所需的事件。如果模組不具有有效的進入點可讓伺服器存取以進行註冊,註冊便會失敗。
若要解決此問題,請按照下列步驟進行:
建立 ApplicationHost.config 檔案的備份。若要執行此操作,請參閱區段 A。
將模組從 ApplicationHost.config 的 globalModules 區段中的模組清單中移除。 若 ApplicationHost.confi 中有列出該模組,伺服器將嘗試在啟動時將它載入,且嘗試使用該模組的每個工作者處理序都將無法執行該操作。若要將模組從組態中移除,請參閱區段 B。
請開發人員修正模組中的進入點,讓模組能夠成功向伺服器註冊。
修正模組的進入點之後,請將該模組重新新增至 ApplicationHost.config。
建立 ApplicationHost.config 檔案的備份
建立 ApplicationHost.config 檔案的備份:
開啟提高權限的 [命令提示字元] 視窗。按一下 [開始],指向 [所有程式],按一下 [附屬應用程式],以滑鼠右鍵按一下 [命令提示字元],然後按一下 [以系統管理員身分執行]。
切換至目錄 %Windir%\system32\inetsrv。
輸入 appcmd add backup backupName 來備份 ApplicationHost.config 檔案。
系統將在 %Windir%\system32\inetsrv\backup 目錄底下使用您指定的備份名稱建立一個目錄。如果您不指定名稱,appcmd 會自動使用目前的日期和時間來產生目錄名稱。
將模組從設定中移除
將模組從設定中移除:
開啟提高權限的 [命令提示字元] 視窗。按一下 [開始],指向 [所有程式],按一下 [附屬應用程式],以滑鼠右鍵按一下 [命令提示字元],然後按一下 [以系統管理員身分執行]。
將目錄切換至 %Windir%\system32\inetsrv\config。
輸入 notepad ApplicationHost.config。
在記事本中,在 [system.webServer] 部分底下搜尋 [globalModules] 部分。
尋找失敗的模組項目並將其移除。
儲存 ApplicationHost.config 檔案,然後結束記事本。
如需有關 globalModules 區段的詳細資訊,請參閱 IIS 8: 新增 globalModules 的元素 (IIS 設定結構描述) (英文)。
Target | Microsoft.Windows.InternetInformationServices.6.2.WebServer |
Category | Alert |
Enabled | True |
Event_ID | 2293 |
Event Source | Microsoft-Windows-IIS-W3SVC-WP |
Alert Generate | False |
Remotable | True |
Event Log | Application |
ID | Module Type | TypeId | RunAs |
---|---|---|---|
DS | DataSource | Microsoft.Windows.EventProvider | Default |
WA | WriteAction | Microsoft.Windows.Server.IIS.6.2.GenerateAlertAction.SuppressedByDescription | Default |
<Rule ID="Microsoft.Windows.InternetInformationServices.6.2.Module.registration.error.detected.module.returned.an.error.during.registration" Enabled="true" Target="Microsoft.Windows.InternetInformationServices.6.2.WebServer" ConfirmDelivery="false" Remotable="true" Priority="Normal" DiscardLevel="100">
<Category>Alert</Category>
<DataSources>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.EventProvider">
<ComputerName>$Target/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</ComputerName>
<LogName>Application</LogName>
<Expression>
<And>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">PublisherName</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Microsoft-Windows-IIS-W3SVC-WP</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>EventDisplayNumber</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>2293</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="WA" TypeID="Microsoft.Windows.Server.IIS.6.2.GenerateAlertAction.SuppressedByDescription">
<Priority>1</Priority>
<Severity>1</Severity>
<AlertMessageId>$MPElement[Name="Microsoft.Windows.InternetInformationServices.6.2.Module.registration.error.detected.module.returned.an.error.during.registration.AlertMessage"]$</AlertMessageId>
</WriteAction>
</WriteActions>
</Rule>