你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Azure Application Insights libraries for .NET

Overview

Application Insights is an extensible monitoring & diagnostics service for web developers with powerful ad-hoc analytics capabilities. 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

The Application Insights client SDK for .NET allows you to log event, aggregated data, exceptions, dependency, and metrics to Azure for future analysis.

Install the NuGet package directly from the Visual Studio Package Manager console or with the .NET Core CLI.

Visual Studio Package Manager

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

Example

This example tracks a custom event to Application Insights.

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

Samples

View the complete list of Azure Application Insights samples.