John Lington John Lington - 1 year ago 80
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.

However when I try to implement

I get the error

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

Answer Source

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="">
    <monitoring xdt:Transform="Insert">
        <!-- 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) -->
          <add statusCode="500" subStatusCode="100" win32StatusCode="0" count="10" timeInterval="00:00:30"/>
        <!-- Scenario #4: Taking custom actions (or recycling/logging) based on memory limit -->
        <memory privateBytesInKB="800000"/>
      <!-- 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%_" />