ApplicationInsights.config is not being used in Azure App Service RRS feed

  • Question

  • I have added ApplicationInsights to my application and can host it locally and see the telemetry reaching my Application Insight Resource. However, when I deploy my application to the Azure App Service Application Insights stops working.

    I have managed to trace this to the ApplicationInsights.config file not being read/used. I serialized the `TelemetryConfiguration.Active` object and wrote it to a log file locally and on Azure. The local file corresponds to my settings in ApplicationInsights.config, the on on Azure does not.

    In fact I can reproduce what is created on Azure locally if I delete the ApplicationInsights.config. So it's kind of a fall back configuration I guess?

    The file looks to be in the correct place on Azure App Service (in the root folder with the web.config).

    I'll be happy to provide more details if someone is able to help.


    Wednesday, August 28, 2019 8:06 PM

All replies

  • TelemetryConfiguration.Active is indeed a default configuration for App Insights that first looks for the default ApplicationInsights.config and sets everything to default if it can't find one.

    Could you share the code you are using to configure Application Insights?  When setting up Application Insights in Visual Studio the initialization is handled in the web.config not Global.asax or a Startup.cs.

    You can also try setting the path to ApplicationInsights.config manually to see if that will clear up the issue:

    using System.IO;
    TelemetryConfiguration configuration = TelemetryConfiguration.CreateFromConfiguration(File.ReadAllText(".\ApplicationInsights.config"));
    var telemetryClient = new TelemetryClient(configuration);

    Thursday, August 29, 2019 5:31 PM