MarcosPauloSouzaMiranda / poc-applicationinsights

POC for Azure Application Insights

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

languages products page_type name urlFragment description
csharp
dotnet-core
azure
sample
Azure Monitor Application Insights Quickstart for ASP.NET Core
azure-monitor-application-insights-quickstart
A sample ASP.NET Core app that demonstrates basic instrumentation for Azure Monitor Application Insights.

Azure Monitor Application Insights Quickstart for ASP.NET Core

This sample ASP.NET Core application was created with dotnet new razor. After that, the following changes were made:

  • The Application Insights SDK was added to the project with dotnet add package Microsoft.ApplicationInsights.AspNetCore --version 2.17.0.
  • A configuration value for ApplicationInsights:InstrumentationKey was added to appsettings.json.
  • services.AddApplicationInsightsTelemetry(); was added to the ConfigureServices method of Startup.cs.
  • @inject Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet was added to Pages/_ViewImports.cshtml.
  • @Html.Raw(JavaScriptSnippet.FullScript) was added to the <head> element in Pages/Shared/_Layout.cshtml.

Prerequisites

Prepare to run the sample

Replace the placeholder ApplicationInsights:InstrumentationKey value in appsettings.json with your actual instrumentation key.

Run the sample

dotnet run

As you use the app, telemetry will be ingested to Application Insights within a few minutes. You can verify the connection using Live Metrics.

About

POC for Azure Application Insights


Languages

Language:C# 47.4%Language:HTML 29.4%Language:CSS 19.8%Language:JavaScript 3.3%