Настройте понимание приложения с помощью веб-задания Azure - PullRequest
0 голосов
/ 24 апреля 2019

Я пытаюсь настроить Application Insights для своей веб-работы (Microsoft.Azure.Webjobs (v: 2.3)

if (!string.IsNullOrEmpty(instrumentationKey))
{
    // Wire up with default filters; Filtering will be explained later.
    config.LoggerFactory = new LoggerFactory()
                .AddApplicationInsights(instrumentationKey, null)
                .AddConsole();

    config.Tracing.ConsoleLevel = TraceLevel.Off;
}

Завод-регистратор недоступен.

Я установил эти пакеты ниже.

<package id="Microsoft.ApplicationInsights" version="2.4.0" targetFramework="net471" />
<package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.4.0" targetFramework="net471" />
<package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.4.1" targetFramework="net471" />
<package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.4.1" targetFramework="net471" />
<package id="Microsoft.ApplicationInsights.WindowsServer" version="2.4.1" targetFramework="net471" />
<package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.4.0" targetFramework="net471" />
<package id="Microsoft.Azure.WebJobs.Logging" version="3.0.6" targetFramework="net471" />
<package id="Microsoft.Azure.WebJobs.Logging.ApplicationInsights" version="2.3.0" targetFramework="net471" />

Спасибо!

Ответы [ 2 ]

2 голосов
/ 24 апреля 2019

Вы установили следующие пакеты NuGet:

  • Microsoft.Azure.WebJobs.Logging.ApplicationInsights
  • Microsoft.Extensions.Logging
  • Microsoft.Extensions.Logging.Console

Посмотрите здесь .

0 голосов
/ 24 апреля 2019

Кажется, что отсутствует конфигурация JobHostConfiguration var config = new JobHostConfiguration();

В противном случае вы можете выполнить настройку, как показано в следующем фрагменте

var builder = new HostBuilder().ConfigureLogging((context, b) =>
{
    b.AddConsole();

    // If the key exists in settings, use it to enable Application Insights.
    var instrumentationKey = context.Configuration["APPINSIGHTS_INSTRUMENTATIONKEY"];
    if (!string.IsNullOrEmpty(instrumentationKey))
    {
        b.AddApplicationInsights(o => o.InstrumentationKey = instrumentationKey);
    }
})
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...