AppInsights TelemetryClient throws exception

Rajesh Kumar 1 Reputation point

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());  

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

    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

    Hi @Rajesh Kumar

    Welcome to Microsoft Q & A community Forum!

    Please refer to this Github discussion about the same issue

    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