您可將 Internet Information Services (IIS) World Wide Web Publishing 服務 (W3SVC) 設定為收集效能資料和執行 HTTP 壓縮。如果將 W3SVC 設定為執行 HTTP 壓縮,則必須指定一個位於 NTFS 磁碟區的有效壓縮目錄。
檢查壓縮目錄
IIS 使用的目錄可讓您在其中暫時快取壓縮版本的靜態檔案。預設目錄是 %SystemDrive%\inetpub\temp\IIS Temporary Compressed Files。為改善檔案查閱次數和安全性,IIS 8 在此資料夾中針對每個應用程式集區建立一個子資料夾,並在每個應用程式集區資料夾中針對每個壓縮方法建立一個子資料夾。
您可使用 [IIS 管理員] 來指定不同的快取資料夾。此設定在伺服器層級進行。快取資料夾設定會儲存在 ApplicationHost.config 檔案中 system.webServer 下方的 httpCompression 區段裡的目錄屬性中。如果所指定的目錄位址不存在或無法存取,系統便會停用靜態壓縮。
若要解決此錯誤,請使用 [IIS 管理員] 來檢查目前設定的值。如果指定的目錄不存在,請建立該目錄或指定存在的新位置。若要使用 [IIS 管理員],請遵循以下步驟。
使用 [IIS 管理員] 修改壓縮目錄位置:
依序按一下 [開始]、[控制台] 和 [系統管理工具]。
對 [Internet Information Services (IIS) 管理員] 按滑鼠右鍵,然後選取 [以系統管理員身分執行]。
在 [IIS 管理員連線] 窗格中按一下電腦名稱。
在 [功能檢視] 中按兩下 [壓縮]。
注意在 [快取目錄:] 下方設定的值。
如果設定的目錄不存在或無法存取,請建立目錄或指定新的目錄。
在 [動作] 窗格中,按一下 [套用]。
關閉 [IIS 管理員]。
如需有關 httpCompression 區段的詳細資訊,請參閱「 IIS 8:httpCompression 元素 (IIS 設定結構)」。
Target | Microsoft.Windows.InternetInformationServices.6.2.WebServer |
Category | Alert |
Enabled | True |
Event_ID | 2264 |
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.The.directory.specified.for.caching.compressed.content.is.invalid" Enabled="onEssentialMonitoring" 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>2264</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.The.directory.specified.for.caching.compressed.content.is.invalid.AlertMessage"]$</AlertMessageId>
</WriteAction>
</WriteActions>
</Rule>