AppInsights TelemetryClient throws exception

Rajesh Kumar 1 Reputation point
2022-10-14T02:48:43.347+00:00

I am getting the following exception in ASP.NET core mvc application when deployed in docker (ubuntu) in Azure.

System.ArgumentException: The specified configuration does not have a telemetry channel. (Parameter 'configuration')
at Microsoft.ApplicationInsights.TelemetryClient..ctor(TelemetryConfiguration configuration)

I have added the following piece of code in the startup.cs

services.AddSingleton(typeof(ITelemetryChannel), new ServerTelemetryChannel());  
        services.AddApplicationInsightsTelemetry();  

Can you please guide me why this error is occuring? Its working perfectly in development environment when run from VS

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,853 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Stefano Demiliani 166 Reputation points MVP
    2022-10-19T12:20:01.437+00:00

    It could be a bug of Microsoft.ApplicationInsights.AspNetCore version 2.17.0.
    If you update to the latest version it should disappear.

    0 comments No comments

  2. Marwa Abouawad 281 Reputation points Microsoft Employee
    2022-10-20T04:12:49.617+00:00

    Hi @Rajesh Kumar

    Welcome to Microsoft Q & A community Forum!

    Please refer to this Github discussion about the same issue https://github.com/microsoft/ApplicationInsights-dotnet/issues/2195

    The issue should be resolved if you update to the latest version.

    If the answer was helpful, to benefit the broader community, please feel free to mark as answered.

    0 comments No comments