Откуда читается InstrumentationKey?
context.Configuration["APPINSIGHTS_INSTRUMENTATIONKEY"];
Я поместил этот ключ в applicationInsights.config в разделе
<InstrumentationKey>94efb022-e651-46a0-b103-5735daa213f1</InstrumentationKey>
но оттуда его не взяли ...
var builder = new HostBuilder()
.UseEnvironment("Development")
.ConfigureWebJobs(b =>
{
// Add extensions and other WebJobs services
})
.ConfigureAppConfiguration(b =>
{
// Add configuration sources
})
.ConfigureLogging((context, b) =>
{
// Add Logging Providers
b.AddConsole();
// If this key exists in any config, use it to enable App Insights
string appInsightsKey = context.Configuration["APPINSIGHTS_INSTRUMENTATIONKEY"];
if (!string.IsNullOrEmpty(appInsightsKey))
{
// This uses the options callback to explicitly set the instrumentation key.
b.AddApplicationInsights(o => o.InstrumentationKey = appInsightsKey);
}
})
.UseConsoleLifetime();