如何将 Azure Application Insights 添加到 .NET Core App?

问题描述 投票:0回答:1

我试图将 Azure Application Insights 添加到我的 .NET Core App 中,这样我就可以看到搜索流量分析,但我只一直在寻找如何为 ASP.NET App 设置此功能的文档,请问设置 Azure Application Insights 是否可以用于 .NET Core App?

谢谢您的时间。

azure azure-application-insights azure-cognitive-search azure-analysis-services azure-search-.net-sdk
1个回答
0
投票

这是同样的方式,你做ASP.NET应用程序。你是否有机会看看 开始监控您的ASP.NET Core Web应用程序 其中包括同样的步骤

  • 创建AppInsights
  • 启用AppInsights
  • 配置App Insights SDK

0
投票

在Visual Studio中打开你的项目,在你要添加Application insights的项目中右击,然后点击发布。转到 "连接的服务",在 "服务依赖 "中,单击 "添加依赖 "并选择Application Insights Sdk(本地),如下图所示。

enter image description here

点击下一步,然后点击完成,安装所需的Nuget包,就可以了。


0
投票

一个可以在本地、Windows和Linux上工作的整体解决方案(Linux上目前是在azure的预览版,但这也可以)环境是。

  1. 创建一个Application Insights账户。
  2. 安装Microsoft.ApplicatoinInsights.AspNetCore nuget。
  3. 使用DI,你需要将应用洞察力客户端注册到服务集合中。你可以在Andrew Lock的文章中找到一个非常好的例子来说明如何做。博客
  4. 注册ApplicationInsights遥测。以后就能帮你开箱即用了。enter image description here
  5. 在你的appsettings文件中添加 "ApplicationInsights",并在里面添加 "InstrumentationKey"(InstrumentationKey可以在你的资源的概览标签中找到)enter image description here

现在,如果你运行你的应用程序,你将能够在你的应用程序洞察账户中捕获所有流量。

© www.soinside.com 2019 - 2024. All rights reserved.