C# 移除警告';遥测配置。活动已过时';在Azure应用程序洞察中

C# 移除警告';遥测配置。活动已过时';在Azure应用程序洞察中,c#,azure-application-insights,C#,Azure Application Insights,我更新了azure application insights,现在收到了警告 'TelemetryConfiguration.Active is obsolete' 我现在有一个这样的方法 static Load() { var pchannel = new inMemoryChannel(); ..... TelemetryConfiguration.Active.TelemetryChannel = pchannel; } 你认为用替代品安全吗 Telemetry

我更新了azure application insights,现在收到了警告

'TelemetryConfiguration.Active is obsolete'
我现在有一个这样的方法

static Load()
{
    var pchannel = new inMemoryChannel();
    .....
    TelemetryConfiguration.Active.TelemetryChannel = pchannel;
}
你认为用替代品安全吗

TelemetryConfiguration.Active.TelemetryChannel = pchannel;
用这个

TelemetryConfiguration.CreateDefault().TelemetryChannel = pchannel;

这将删除警告。

因为
遥测配置.Active
不推荐使用,在asp.net核心应用程序中,我们建议使用
var newConfig=TelemetryConfiguration.CreateDefault()


有关更多详细信息,请参阅。

由于
遥测配置.Active
已被弃用,因此在asp.net核心应用程序中,我们建议使用
var newConfig=TelemetryConfiguration.CreateDefault()


有关更多详细信息,您可以参考。

您认为替换安全吗?我们不建议使用
TelemetryConfiguration.Active
-而是建议使用
Microsoft.Extensions.DependencyInjection
中的DI。如果不使用DI,请使用
TelemetryConfiguration.CreateDefault()
创建配置。请参阅此项。您认为替换安全吗?我们不建议使用
遥测配置.Active
-而是建议使用Microsoft.Extensions.DependencyInjection
中的DI。如果不使用DI,请使用
TelemetryConfiguration.CreateDefault()
创建配置。参考这个。