您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

用于 .NET 的 Azure Application Insights 库Azure Application Insights libraries for .NET

概述Overview

Application Insights 是面向 Web 开发人员的可扩展监视和诊断服务,具有强大的即席分析功能。Application Insights is an extensible monitoring & diagnostics service for web developers with powerful ad-hoc analytics capabilities. 可以使用 ApplicationInsights 命名空间中的类来配置遥测数据的收集,并发送想要监视的应用程序所发出的任何自定义遥测数据。You can use the classes in the ApplicationInsights namespace to configure telemetry collection and send any custom telemetry from your applications that you want to monitor.

客户端库Client library

使用用于 .NET 的 Application Insights 客户端 SDK 可将事件、聚合数据、异常、依赖项和指标记录到 Azure 供将来分析。The Application Insights client SDK for .NET allows you to log event, aggregated data, exceptions, dependency, and metrics to Azure for future analysis.

直接从 Visual Studio 包管理器控制台或使用 .NET Core CLI 安装 NuGet 包Install the NuGet package directly from the Visual Studio Package Manager console or with the .NET Core CLI.

Visual Studio 包管理器Visual Studio Package Manager

Install-Package Microsoft.ApplicationInsights 
dotnet add package Microsoft.ApplicationInsights 

示例Example

此示例在 Application Insights 中跟踪自定义事件。This example tracks a custom event to Application Insights.

TelemetryClient client = new TelemetryClient();
client.TrackEvent("MyCustomEvent");

示例Samples

查看 Azure Application Insights 示例的完整列表View the complete list of Azure Application Insights samples.