Answers for "programmatically set the Instrumentation Key"

0

programmatically set the Instrumentation Key

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");
Posted by: Guest on July-02-2020

Code answers related to "programmatically set the Instrumentation Key"

Browse Popular Code Answers by Language