网站和 Web 应用程序依赖于 Internet Information Services (IIS) 应用程序池的可用性。而 IIS 应用程序池又依赖于 Windows Process Activation Service (WAS)。如果在启动或关闭应用程序池时,WAS 未运行或发生错误,则网站和 Web 应用程序可能不可用。
检查自动关闭可执行文件
可以配置在 World Wide Web 发布服务 (W3SVC) 关闭应用程序池时自动运行用户特定的可执行文件。例如,可执行文件可以重定向应用程序池的流量到另一个服务器。可在 IIS 管理器中指定该文件,同时以 ApplicationHost.config 文件中的 system.applicationHost/applicationPools/failure 部分的 autoShutdownExe 属性表示。
如果 autoShutdownExe 进程运行失败,可能的解决方法包括:
检查是否正确指定 autoShutdownExe 程序的路径和文件名。
确保系统帐户拥有访问和运行文件的权限。
确保程序可独立于应用程序池关闭执行。
检查是否正确指定路径和文件名
单击“开始”,再单击“控制面板”,然后单击“管理工具”。
右键单击 Internet Information Services (IIS) 管理器并选择“以管理员身份运行”。
在“连接”窗格中,展开服务器名称。
单击应用程序池。将在中间窗格中显示服务器上的应用程序池的列表。
在中间窗格中,单击要检查关闭可执行文件的应用程序池。
在“操作”窗格中,单击“高级设置”。将显示“高级设置”窗口。
向下滚动到“快速故障防护”部分。
找到“关闭可执行文件”条目并检查右侧的路径和文件名。确保路径和文件名正确。
单击“确定”。
检查关闭可执行文件的访问控制列表
打开提升的命令提示符窗口。单击“开始”,指向“所有程序”,再单击“附件”,右键单击“命令提示符”,然后单击“以管理员身份运行”。
键入 start explorer。
使用 Windows 资源管理器导航到关闭可执行文件。
右键单击文件,并选择“属性”。将显示可执行文件“属性”对话框。
单击“安全”选项卡。
在“组”或“用户名:”窗口中,确保显示 SYSTEM。如果未显示,单击“编辑”添加系统帐户。
在 SYSTEM 窗口的“权限”中,确保系统帐户至少拥有对关闭可执行文件的读取和执行权限。
确保程序可独立执行
独立于应用程序池关闭事件测试运行可执行程序。如果进程可以独立于应用程序池关闭运行,则当 WAS 自动禁用应用程序池时,该进程应能正常运行。
Target | Microsoft.Windows.InternetInformationServices.10.0.ApplicationPool |
Category | Alert |
Enabled | True |
Alert Generate | False |
Remotable | True |
ID | Module Type | TypeId | RunAs |
---|---|---|---|
DS | DataSource | Microsoft.Windows.Server.IIS.10.0.WarningAndErrorEventProvider | Default |
Filter | ConditionDetection | Microsoft.Windows.InternetInformationServices.10.0.ApplicationPool.EventFilter | Default |
WA | WriteAction | Microsoft.Windows.Server.IIS.10.0.GenerateAlertAction.SuppressedByDescription | Default |
<Rule ID="Microsoft.Windows.InternetInformationServices.10.0.WAS.did.not.run.the.automatic.shutdown.executable.for.application.pool" Enabled="true" Target="Microsoft.Windows.InternetInformationServices.10.0.ApplicationPool" ConfirmDelivery="false" Remotable="true" Priority="Normal" DiscardLevel="100">
<Category>Alert</Category>
<DataSources>
<DataSource ID="DS" TypeID="Microsoft.Windows.Server.IIS.10.0.WarningAndErrorEventProvider">
<LogName>System</LogName>
</DataSource>
</DataSources>
<ConditionDetection ID="Filter" TypeID="Microsoft.Windows.InternetInformationServices.10.0.ApplicationPool.EventFilter">
<Expression>
<And>
<Expression>
<RegExExpression>
<ValueExpression>
<XPathQuery>EventDisplayNumber</XPathQuery>
</ValueExpression>
<Operator>MatchesRegularExpression</Operator>
<Pattern>^(5054|5091)$</Pattern>
</RegExExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">PublisherName</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Microsoft-Windows-WAS</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
</ConditionDetection>
<WriteActions>
<WriteAction ID="WA" TypeID="Microsoft.Windows.Server.IIS.10.0.GenerateAlertAction.SuppressedByDescription">
<Priority>1</Priority>
<Severity>2</Severity>
<AlertMessageId>$MPElement[Name="Microsoft.Windows.InternetInformationServices.10.0.WAS.did.not.run.the.automatic.shutdown.executable.for.application.pool.AlertMessage"]$</AlertMessageId>
</WriteAction>
</WriteActions>
</Rule>