📌  相关文章
📜  以编程方式设置检测密钥 - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:12.745000             🧑  作者: Mango

代码示例1
var instrumentationKey = ConfigurationManager.AppSettings["ApplicationInsightsInstrumentationKey"];

if (string.IsNullOrWhiteSpace(instrumentationKey))
{
    throw new ConfigurationErrorsException("Missing app setting 'ApplicationInsightsInstrumentationKey' used for Application Insights");
}

TelemetryConfiguration.Active.InstrumentationKey = instrumentationKey;

new TelemetryClient().TrackEvent("Application started");