繁体   English   中英

无法从 Nuget for Azure Function 应用安装 ApplicationInsights

[英]Unable to install ApplicationInsights from Nuget for Azure Function app

我正在使用 .NET Core 6 中的 Azure 函数,但无法初始化Application Insights 我尝试安装“Microsoft.ApplicationInsights.AspNetCore -Version 2.20.0”,但无法安装并出现异常:

在此处输入图像描述

错误:

在此处输入图像描述

我试过这个命令:

Install-Package Microsoft.ApplicationInsights.AspNetCore -Version 2.20.0

请检查以下步骤是否有助于解决问题:

  1. 在 Visual Studio - Azure Functions Project Publish Window > 单击Restore Service dependencies and their settings图标,然后安装Microsoft.ApplicationInsights.AspNetCore

在此处输入图像描述

  1. 在 VS > Tools > NuGet Packet Manager 中检查这些选项

另外,请检查此SO Thread中给出的解决方法。

Azure Functions 自动添加 Application Insights。 不应将Microsoft.ApplicationInsights.AspNetCore包添加到 Azure Functions 项目,因为这样做可能会出现不兼容问题。 相反,如果您想编写自定义遥测,请使用位于此处Microsoft.Azure.WebJobs.Logging.ApplicationInsights NuGet 包,如文档那些文档所示:

Application Insights SDK 有一个特定于函数的版本,可用于将自定义遥测数据从函数发送到 Application Insights:Microsoft.Azure.WebJobs.Logging.ApplicationInsights

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM