System.webServer具有无效的子元素'monitoring'

时间:2016-11-15 08:56:46

标签: c# asp.net-mvc azure iis

我正在使用带有本地IIS express和Azure Web应用程序的Visual Studio 2015。

我正在尝试使用这些说明实现Worker进程回收。

https://azure.microsoft.com/en-us/blog/auto-healing-windows-azure-web-sites/

但是,当我尝试实施<monitoring><trigger>时,我收到了错误

元素'system.webServer'具有无效的子元素'monitoring'

1 个答案:

答案 0 :(得分:5)

它可能只是Azure的一项功能,因此我建议您将其添加到转换文件中。即web.autoheal.config

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <system.webServer>
    <monitoring xdt:Transform="Insert">
      <triggers>
        <!-- Scenario #1: Recycling based on Request Count -->
        <requests count="1000" timeInterval="00:10:00"/>
        <!-- Scenario #2: Recycling based on slow requests -->
        <slowRequests timeTaken="00:00:45" count="20" timeInterval="00:02:00" />
        <!-- Scenario #3: Logging an event (or recycling) based on HTTP status code(s) -->
        <statusCode>
          <add statusCode="500" subStatusCode="100" win32StatusCode="0" count="10" timeInterval="00:00:30"/>
        </statusCode>
        <!-- Scenario #4: Taking custom actions (or recycling/logging) based on memory limit -->
        <memory privateBytesInKB="800000"/>
      </triggers>
      <!-- Scenario #1 & #2 Action -->
      <actions value="Recycle"/>
      <!-- Scenario #3 Action -->
      <actions value="LogEvent"/>
      <!-- Scenario #4 Action  -->
      <actions value="CustomAction">
        <customAction exe="d:\home\procdump.exe" parameters="-accepteula w3wp d:\home\w3wp_PID_%1%_" />
      </actions>
    </monitoring>
  </system.webServer>
</configuration>