次の方法で共有


構成ファイルを使用した監視の構成

Web.config は、Windows Server AppFabric でホストされている Web アプリケーションの監視構成情報を含む XML ファイルです。アプリケーションのメイン Web.config ファイルは、Web アプリケーションのルート ディレクトリにあります。ASP.NET では、階層構成スキームを使用して構成情報を分離しています。この分離によって、他の構成ファイルから構成設定を継承することが可能になり、サブディレクトリの Web.config での実際のエントリが最小限で済みます。

メインの Web.config ファイルへの構成変更を確定すると、アプリケーション ドメインが自動的にリサイクルされます。場合により、これは望ましくないことがあります。アプリケーション ドメインがリサイクルされないようにするには、アプリケーションの Web.config ファイルとは別個に存在する他のファイルに、アプリケーションのメイン構成情報を分離します。メインの Web.config ファイルと同じディレクトリにある別個のファイルに構成セクションを移動します。そのうえで、.NET Framework Version 4 の SectionInformation::ConfigSource (https://go.microsoft.com/fwlink/?LinkId=183510) プロパティを使用して、メインの Web.config ファイルからそのセクションを参照します。

監視に関連した構成情報をメインの Web.config ファイルからリンク先の構成ファイルに分離する手順は、次のとおりです。

構成情報を別個の構成ファイルに移動するには

  1. diagnostics セクションを DiagnosticsConfigSource.config という名前の別個の構成ファイルに移動します。

    メイン アプリケーションの Web.config ファイル 別個の DiagnosticsConfigSource.config ファイル
    <?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. behaviors セクションを ServiceBehaviorsConfigSource.config という名前の別個の構成ファイルに移動します。

    メイン アプリケーションの Web.config ファイル 別個の ServiceBehaviorsConfigSource.config ファイル
    <?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. microsoft.applicationServer セクションを MonitoringEventCollector.config という名前の別個の構成ファイルに移動します。

    メイン アプリケーションの Web.config ファイル 別個の MonitoringEventCollector.config ファイル
    <?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>

ヒント

別個のファイルの名前は任意です。唯一の要件は、実際の構成ファイル名が、メインの Web.config ファイルで configSource プロパティを使用して定義した名前と正確に一致している必要があることです。

ヒント

AppFabric ユーザー インターフェイスでアプリケーションの監視レベルを変更すると、これらのファイルが自動的に変更されます。

  2011-12-05