小编Ras*_*nov的帖子

Azure Application Insights 不显示数据

我有一个作为 Azure 应用服务运行的 ASP.NET Core 应用程序。Azure Application Insights 已启用(我按照这些说明进行操作)。问题是我的 Azure 门户上的 Azure Insights 实例除了实时指标之外没有显示任何有用的数据(请参见屏幕截图)。正如您所看到的,屏幕截图上有多个请求和自定义事件。

但是,当我打开交易搜索时,它什么也没有显示(参见屏幕截图)。活动页面也是空的(参见屏幕截图)。

到目前为止,我仔细检查了 InstrumentKey。我还尝试使用 ConnectionString 而不是 InstrumentKey,但没有帮助。

我的应用程序在 .NET Core 3.1 上运行。我安装了最新版本的 Microsoft.ApplicationInsights.AspNetCore 包,即 2.19.0。

以下是在 Program.cs 中配置日志记录的方式:

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
        WebHost.CreateDefaultBuilder(args)
            .UseStartup<Startup>()
            .ConfigureLogging(builder =>
            {
                builder.AddFilter<ApplicationInsightsLoggerProvider>("", LogLevel.Information);
            });
Run Code Online (Sandbox Code Playgroud)

下面是 Startup.cs 中的代码:

services.AddApplicationInsightsTelemetry(new ApplicationInsightsServiceOptions 
        {
            ConnectionString = Environment.GetEnvironmentVariable("APPLICATIONINSIGHTS_CONNECTION_STRING")
        });
Run Code Online (Sandbox Code Playgroud)

LogLevel 也在 appsettings.json 中配置:

"Logging": {
"LogLevel": {
  "Default": "Warning"
},
"ApplicationInsights": {
  "LogLevel": {
    "Default": "Information" …
Run Code Online (Sandbox Code Playgroud)

asp.net azure azure-application-insights .net-core

9
推荐指数
1
解决办法
2万
查看次数