简体   繁体   中英

Removing the warning 'TelemetryConfiguration.Active is obsolete' in Azure application insights

I updated my azure application insights and now I am getting the warning

'TelemetryConfiguration.Active is obsolete'

I currently have a method like this

static Load()
{
    var pchannel = new inMemoryChannel();
    .....
    TelemetryConfiguration.Active.TelemetryChannel = pchannel;
}

Do you think it will be safe to substitute

TelemetryConfiguration.Active.TelemetryChannel = pchannel;

with this

TelemetryConfiguration.CreateDefault().TelemetryChannel = pchannel;

This removes the warning.

Since TelemetryConfiguration.Active is deprecated, in asp.net core app, we suggest to use var newConfig = TelemetryConfiguration.CreateDefault();

For more details, you could refer to this issue .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM