Configure Monitoring Using Configuration Files

Web.config is an XML file that stores monitoring configuration information for a Web application hosted in Windows Server AppFabric. An application’s main Web.config file resides in the root directory of the Web application. ASP.NET uses a hierarchical configuration scheme to separate configuration information. This separation allows inheritance of configuration settings from other configuration files to minimize the actual Web.config entries at a subdirectory.

When configuration changes are committed to the main Web.config file, the app domain is automatically recycled. In certain cases this may not be desirable. To avoid the recycling of the app domain, separate an application’s main configuration information into additional files that exist independently from the application’s Web.config file. The configuration section is moved to a separate file in the same directory as the main Web.config file. It is then referenced from within the main Web.config file by using the .NET Framework version 4 property SectionInformation::ConfigSource (https://go.microsoft.com/fwlink/?LinkId=183510).

The steps to separate the monitoring-related configuration information from the main Web.config file into linked configuration files are outlined below.

To move configuration information to separate configuration files

  1. Move the diagnostics section to a separate configuration file named DiagnosticsConfigSource.config.

    Main application’s Web.config file Separate DiagnosticsConfigSource.config file
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    

    <system.serviceModel> <diagnostics configSource="DiagnosticsConfigSource.config" /> </system.serviceModel>

    </configuration>

    <?xml version="1.0" encoding="UTF-8"?>
    <diagnostics etwProviderId="e8a6636e-1213-497e-b5c5-5350627e719e">
    <endToEndTracing propagateActivity="false" messageFlowTracing="false" />
    </diagnostics>
  2. Move the behaviors section to a separate configuration file named ServiceBehaviorsConfigSource.config.

    Main application’s Web.config file Separate ServiceBehaviorsConfigSource.config file
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    

    <system.serviceModel> <diagnostics configSource="DiagnosticsConfigSource.config" /> <behaviors configSource="ServiceBehaviorsConfigSource.config" /> </system.serviceModel>

    </configuration>

    <?xml version="1.0" encoding="UTF-8"?>
    <behaviors>
    <serviceBehaviors>
    <behavior name="">
    <etwTracking profileName="EndToEndMonitoring Tracking Profile" />
    </behavior>
    </serviceBehaviors>
    </behaviors>
  3. Move the microsoft.applicationServer section to a separate configuration file named MonitoringEventCollector.config.

    Main application’s Web.config file Separate MonitoringEventCollector.config file
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    

    <microsoft.applicationServer> <monitoring configSource="MonitoringEventCollector.config" /> </microsoft.applicationServer>

    <system.serviceModel> <diagnostics configSource="DiagnosticsConfigSource.config" /> <behaviors configSource="ServiceBehaviorsConfigSource.config" /> </system.serviceModel>

    </configuration>

    <?xml version="1.0" encoding="UTF-8"?>
    <monitoring>
    <default enabled="true" connectionStringName="ApplicationServerMonitoringConnectionString" monitoringLevel="HealthMonitoring" />
    </monitoring>

Note

The names of these separate files are arbitrary. The only requirement is that the actual configuration file name matches the name precisely as it is defined using the configSource property in the main Web.config file.

Note

These files are modified automatically when the monitoring level is changed for an application within the AppFabric user interface.