[英]Unable to install ApplicationInsights from Nuget for Azure Function app
I am working on an Azure Function in .NET Core 6 but I'm unable to initialize Application Insights
.我正在使用 .NET Core 6 中的 Azure 函数,但无法初始化
Application Insights
。 I tried to install `Microsoft.ApplicationInsights.AspNetCore -Version 2.20.0' but I'm unable to do so and get an exception:我尝试安装“Microsoft.ApplicationInsights.AspNetCore -Version 2.20.0”,但无法安装并出现异常:
Error:错误:
I tried this command:我试过这个命令:
Install-Package Microsoft.ApplicationInsights.AspNetCore -Version 2.20.0
Please check if the below steps would help to fix the issue:请检查以下步骤是否有助于解决问题:
Restore Service dependencies and their settings
icon and then Install the Microsoft.ApplicationInsights.AspNetCore
.Restore Service dependencies and their settings
图标,然后安装Microsoft.ApplicationInsights.AspNetCore
。 Also, please check this workaround given in this SO Thread .另外,请检查此SO Thread中给出的解决方法。
Application Insights is added by Azure Functions automatically. Azure Functions 自动添加 Application Insights。 You should not add the
Microsoft.ApplicationInsights.AspNetCore
package to an Azure Functions project as there might be incompatibility issues doing it that way.不应将
Microsoft.ApplicationInsights.AspNetCore
包添加到 Azure Functions 项目,因为这样做可能会出现不兼容问题。 Instead, if you want to write custom telemetry use the Microsoft.Azure.WebJobs.Logging.ApplicationInsights
NuGet packages located here as shown by the docs and those docs :相反,如果您想编写自定义遥测,请使用位于此处的
Microsoft.Azure.WebJobs.Logging.ApplicationInsights
NuGet 包,如文档和那些文档所示:
There is a Functions-specific version of the Application Insights SDK that you can use to send custom telemetry data from your functions to Application Insights: Microsoft.Azure.WebJobs.Logging.ApplicationInsights
Application Insights SDK 有一个特定于函数的版本,可用于将自定义遥测数据从函数发送到 Application Insights:Microsoft.Azure.WebJobs.Logging.ApplicationInsights
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.