John Lington John Lington - 10 days ago 5
C# Question

System.webServer has invalid child element 'monitoring'

I am using Visual Studio 2015 with a local IIS express and Azure web application.

I'm trying to implement the Worker process recycle using these instructions.

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

However when I try to implement

<monitoring>
and
<trigger>
I get the error

The element 'system.webServer' has invalid child element 'monitoring'

Answer

It is probably a Azure only feature, so I would recommend you to add it in your transformation file. i.e. 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>