Integrate App Insights with Linux .NET Web App

Published Sep 22 2021 10:52 AM 2,041 Views
Microsoft

Application Insights is a useful tool to monitor service performance whether for data analysis or debugging purpose. While it comes with Windows-based .NET Web Apps by default when creating the app from Azure Portal, it is missing on Linux platform. This article will give instructions on how to integrate App Insights with Linux .NET Web App so that we can enjoy the similar experience on Linux. 

 

Generally speaking, with Linux .NET Web Apps, we need to leverage App Insights SDK to collect telemetries and send them over to App Insights server. After that, App Insights Portal page will be able to retrieve and display metrics and logs.

 

Using .NET 5 MVC app as an example, only 6 steps needed to enable server-side monitoring:

1. Create Application Insights resource via Azure Portal. Normally, make App Insights in the same region with the Web App so that data transmission can be faster.

 

YangYu_0-1632330452770.png

 

2. Jot down the Instrumentation Key on the Overview blade of the App Insights created.

 

YangYu_2-1632330914355.png

 

3. Add app setting “APPINSIGHTS_INSTRUMENTATIONKEY = YourAppInsightsInstrumentationKey” to your web app.

 

YangYu_1-1632330738279.png

 

4. Add below reference in your project's .csproj file.

 

<ItemGroup>

<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.16.0" />

</ItemGroup>

 

5. Add services.AddApplicationInsightsTelemetry(); to the ConfigureServices() method in your Startup class.

 

public void ConfigureServices(IServiceCollection services)

{

// The following line enables Application Insights telemetry collection.

services.AddApplicationInsightsTelemetry();

 

// This code adds other services for your application.

services.AddMvc();

}

 

6. Rebuild and redeploy your web app.

 

If client-side telemetry is also desired, there are additional 2 steps before recompiling the code:

1. In _ViewImports.cshtml, add injection:

 

@inject MicrosoftApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet

 

2. In _Layout.cshtml, insert HtmlHelper at the end of the <head> section but before any other script.

 

<head>

...

@Html.Raw(JavaScriptSnippet.FullScript)

</head>

 

A common use case is troubleshooting site slowness. Performance bottleneck can be narrowed down with the help of App Insights End-to-end transaction details. With the transaction flow in place, we can easily tell if bottleneck is with the application itself or some external dependencies like database. In other words, we can ensure our next investigation is on the right track.

 

YangYu_3-1632332331560.png

 

 

References:

Azure Application Insights for ASP.NET Core applications - Azure Monitor | Microsoft Docs

 

 

 

%3CP%3E%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E5.%20Add%20%3CSTRONG%3Eservices.AddApplicationInsightsTelemetry()%3B%3C%2FSTRONG%3E%20to%20the%20%3CSTRONG%3EConfigureServices()%3C%2FSTRONG%3E%20method%20in%20your%20%3CSTRONG%3EStartup%3C%2FSTRONG%3E%20class.%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3Epublic%20void%20ConfigureServices(IServiceCollection%20services)%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%7B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-60px%22%3E%2F%2F%20The%20following%20line%20enables%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22markh5ft2i6zj%22%20data-markjs%3D%22true%22%20data-ogac%3D%22%22%20data-ogab%3D%22%22%20data-ogsc%3D%22%22%20data-ogsb%3D%22%22%3EApp%3C%2FSPAN%3Elication%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22markpy9b4rd87%22%20data-markjs%3D%22true%22%20data-ogac%3D%22%22%20data-ogab%3D%22%22%20data-ogsc%3D%22%22%20data-ogsb%3D%22%22%3EInsights%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Etelemetry%20collection.%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-60px%22%3Eservices.AddApplicationInsightsTelemetry()%3B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-60px%22%3E%2F%2F%20This%20code%20adds%20other%20services%20for%20your%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22markh5ft2i6zj%22%20data-markjs%3D%22true%22%20data-ogac%3D%22%22%20data-ogab%3D%22%22%20data-ogsc%3D%22%22%20data-ogsb%3D%22%22%3Eapp%3C%2FSPAN%3Elication.%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-60px%22%3Eservices.AddMvc()%3B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%7D%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E6.%20Rebuild%20and%20redeploy%20your%20web%20app.%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%22%3EIf%20%3CSTRONG%3Eclient-side%3C%2FSTRONG%3E%20telemetry%20is%20also%20desired%2C%20there%20are%20%3CSTRONG%3Eadditional%202%20steps%3C%2FSTRONG%3E%20before%20recompiling%20the%20code%3A%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E1.%20In%20%3CSTRONG%3E_ViewImports.cshtml%3C%2FSTRONG%3E%2C%20add%20injection%3A%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%40inject%20Microsoft%3CSPAN%20class%3D%22markh5ft2i6zj%22%20data-markjs%3D%22true%22%20data-ogac%3D%22%22%20data-ogab%3D%22%22%20data-ogsc%3D%22%22%20data-ogsb%3D%22%22%3EApp%3C%2FSPAN%3ElicationInsights.AspNetCore.JavaScriptSnippet%20JavaScriptSnippet%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E2.%20In%20%3CSTRONG%3E_Layout.cshtml%3C%2FSTRONG%3E%2C%20insert%20%3CSTRONG%3EHtmlHelper%3C%2FSTRONG%3E%20at%20the%20end%20of%20the%20%3CSTRONG%3E%3C%2FSTRONG%3E%20section%20but%20before%20any%20other%20script.%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E...%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%40Html.Raw(JavaScriptSnippet.FullScript)%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%22%3EA%20common%20use%20case%20is%20troubleshooting%20site%20slowness.%20Performance%20bottleneck%20can%20be%20narrowed%20down%20with%20the%20help%20of%20%3CSTRONG%3EApp%20Insights%20End-to-end%20transaction%20details%3C%2FSTRONG%3E.%20With%20the%20transaction%20flow%20in%20place%2C%20we%20can%20easily%20tell%20if%20bottleneck%20is%20with%20the%20application%20itself%20or%20some%20external%20dependencies%20like%20database.%20In%20other%20words%2C%20we%20can%20ensure%20our%20next%20investigation%20is%20on%20the%20right%20track.%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22YangYu_3-1632332331560.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F312204iEEFD983ECD6D7A55%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22YangYu_3-1632332331560.png%22%20alt%3D%22YangYu_3-1632332331560.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EReferences%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-monitor%2Fapp%2Fasp-net-core%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Application%20Insights%20for%20ASP.NET%20Core%20applications%20-%20Azure%20Monitor%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2775376%22%20slang%3D%22en-US%22%3EIntegrate%20App%20Insights%20with%20Linux%20.NET%20Web%20App%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2775376%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSTRONG%3EApplication%20Insights%3C%2FSTRONG%3E%20is%20a%20useful%20tool%20to%20monitor%20service%20performance%20whether%20for%20data%20analysis%20or%20debugging%20purpose.%20While%20it%20comes%20with%20Windows-based%20.NET%20Web%20Apps%20by%20default%20when%20creating%20the%20app%20from%20Azure%20Portal%2C%20it%20is%20missing%20on%20Linux%20platform.%20This%20article%20will%20give%20instructions%20on%20how%20to%20integrate%26nbsp%3BApp%20Insights%20with%20Linux%20.NET%20Web%20App%20so%20that%20we%20can%20enjoy%20the%20similar%20experience%20on%20Linux.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EGenerally%20speaking%2C%20with%20Linux%20.NET%20Web%20Apps%2C%20we%20need%20to%20leverage%20%3CSTRONG%3EApp%20Insights%20SDK%3C%2FSTRONG%3E%20to%20collect%20telemetries%20and%20send%20them%20over%20to%20App%20Insights%20server.%20After%20that%2C%20App%20Insights%20Portal%20page%20will%20be%20able%20to%20retrieve%20and%20display%20metrics%20and%20logs.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EUsing%20.NET%205%20MVC%20app%20as%20an%20example%2C%20%3CSTRONG%3Eonly%206%20steps%3C%2FSTRONG%3E%20needed%20to%20enable%20%3CSTRONG%3Eserver-side%3C%2FSTRONG%3E%20monitoring%3A%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E1.%20Create%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E%3CSPAN%20class%3D%22markh5ft2i6zj%22%20data-markjs%3D%22true%22%20data-ogac%3D%22%22%20data-ogab%3D%22%22%20data-ogsc%3D%22%22%20data-ogsb%3D%22%22%3EApp%3C%2FSPAN%3Elication%26nbsp%3B%3C%2FSTRONG%3E%3CSPAN%20class%3D%22markpy9b4rd87%22%20data-markjs%3D%22true%22%20data-ogac%3D%22%22%20data-ogab%3D%22%22%20data-ogsc%3D%22%22%20data-ogsb%3D%22%22%3E%3CSTRONG%3EInsights%3C%2FSTRONG%3E%20resource%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Evia%20Azure%20Portal.%20Normally%2C%20make%20App%20Insights%20in%20the%20same%20region%20with%20the%20Web%20App%20so%20that%20data%20transmission%20can%20be%20faster.%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22YangYu_0-1632330452770.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F312139i6AE1CA39D3CF3567%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22YangYu_0-1632330452770.png%22%20alt%3D%22YangYu_0-1632330452770.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E2.%20Jot%20down%20the%26nbsp%3B%3CSTRONG%3EInstrumentation%20Key%3C%2FSTRONG%3E%26nbsp%3Bon%20the%20%3CSTRONG%3EOverview%3C%2FSTRONG%3E%20blade%20of%20the%20%3CSTRONG%3EApp%20Insights%3C%2FSTRONG%3E%20created.%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22YangYu_2-1632330914355.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F312144i3216F53AE7DD478F%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22YangYu_2-1632330914355.png%22%20alt%3D%22YangYu_2-1632330914355.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E3.%20Add%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22markh5ft2i6zj%22%20data-markjs%3D%22true%22%20data-ogac%3D%22%22%20data-ogab%3D%22%22%20data-ogsc%3D%22%22%20data-ogsb%3D%22%22%3Eapp%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Esetting%20%E2%80%9C%3CSTRONG%3E%3CSPAN%20class%3D%22markh5ft2i6zj%22%20data-markjs%3D%22true%22%20data-ogac%3D%22%22%20data-ogab%3D%22%22%20data-ogsc%3D%22%22%20data-ogsb%3D%22%22%3EAPP%3C%2FSPAN%3EINSIGHTS_INSTRUMENTATIONKEY%3C%2FSTRONG%3E%20%3D%20%3CSTRONG%3EYourAppInsightsInstrumentationKey%3C%2FSTRONG%3E%E2%80%9D%20to%20your%20web%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22markh5ft2i6zj%22%20data-markjs%3D%22true%22%20data-ogac%3D%22%22%20data-ogab%3D%22%22%20data-ogsc%3D%22%22%20data-ogsb%3D%22%22%3Eapp%3C%2FSPAN%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22YangYu_1-1632330738279.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F312142i4AFA062A39562D8C%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22YangYu_1-1632330738279.png%22%20alt%3D%22YangYu_1-1632330738279.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E4.%20Add%20below%20reference%20in%20your%20project's%20%3CSTRONG%3E.csproj%3C%2FSTRONG%3E%20file.%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%3CITEMGROUP%3E%3C%2FITEMGROUP%3E%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-60px%22%3E%3CPACKAGEREFERENCE%20include%3D%22%26quot%3BMicrosoft.%26lt%3BSPAN%22%20class%3D%22markh5ft2i6zj%22%20data-markjs%3D%22true%22%20data-ogac%3D%22%22%20data-ogab%3D%22%22%20data-ogsc%3D%22%22%20data-ogsb%3D%22%22%3EApplicationInsights.AspNetCore%22%20Version%3D%222.16.0%22%20%2F%26gt%3B%3C%2FPACKAGEREFERENCE%3E%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CP%3E%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E5.%20Add%20%3CSTRONG%3Eservices.AddApplicationInsightsTelemetry()%3B%3C%2FSTRONG%3E%20to%20the%20%3CSTRONG%3EConfigureServices()%3C%2FSTRONG%3E%20method%20in%20your%20%3CSTRONG%3EStartup%3C%2FSTRONG%3E%20class.%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3Epublic%20void%20ConfigureServices(IServiceCollection%20services)%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%7B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-60px%22%3E%2F%2F%20The%20following%20line%20enables%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22markh5ft2i6zj%22%20data-markjs%3D%22true%22%20data-ogac%3D%22%22%20data-ogab%3D%22%22%20data-ogsc%3D%22%22%20data-ogsb%3D%22%22%3EApp%3C%2FSPAN%3Elication%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22markpy9b4rd87%22%20data-markjs%3D%22true%22%20data-ogac%3D%22%22%20data-ogab%3D%22%22%20data-ogsc%3D%22%22%20data-ogsb%3D%22%22%3EInsights%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Etelemetry%20collection.%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-60px%22%3Eservices.AddApplicationInsightsTelemetry()%3B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-60px%22%3E%2F%2F%20This%20code%20adds%20other%20services%20for%20your%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22markh5ft2i6zj%22%20data-markjs%3D%22true%22%20data-ogac%3D%22%22%20data-ogab%3D%22%22%20data-ogsc%3D%22%22%20data-ogsb%3D%22%22%3Eapp%3C%2FSPAN%3Elication.%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-60px%22%3Eservices.AddMvc()%3B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%7D%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E6.%20Rebuild%20and%20redeploy%20your%20web%20app.%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%22%3EIf%20%3CSTRONG%3Eclient-side%3C%2FSTRONG%3E%20telemetry%20is%20also%20desired%2C%20there%20are%20%3CSTRONG%3Eadditional%202%20steps%3C%2FSTRONG%3E%20before%20recompiling%20the%20code%3A%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E1.%20In%20%3CSTRONG%3E_ViewImports.cshtml%3C%2FSTRONG%3E%2C%20add%20injection%3A%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%40inject%20Microsoft%3CSPAN%20class%3D%22markh5ft2i6zj%22%20data-markjs%3D%22true%22%20data-ogac%3D%22%22%20data-ogab%3D%22%22%20data-ogsc%3D%22%22%20data-ogsb%3D%22%22%3EApp%3C%2FSPAN%3ElicationInsights.AspNetCore.JavaScriptSnippet%20JavaScriptSnippet%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E2.%20In%20%3CSTRONG%3E_Layout.cshtml%3C%2FSTRONG%3E%2C%20insert%20%3CSTRONG%3EHtmlHelper%3C%2FSTRONG%3E%20at%20the%20end%20of%20the%20%3CSTRONG%3E%3C%2FSTRONG%3E%20section%20but%20before%20any%20other%20script.%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E...%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%40Html.Raw(JavaScriptSnippet.FullScript)%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%20lia-indent-padding-left-30px%22%3E%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%22%3EA%20common%20use%20case%20is%20troubleshooting%20site%20slowness.%20Performance%20bottleneck%20can%20be%20narrowed%20down%20with%20the%20help%20of%20%3CSTRONG%3EApp%20Insights%20End-to-end%20transaction%20details%3C%2FSTRONG%3E.%20With%20the%20transaction%20flow%20in%20place%2C%20we%20can%20easily%20tell%20if%20bottleneck%20is%20with%20the%20application%20itself%20or%20some%20external%20dependencies%20like%20database.%20In%20other%20words%2C%20we%20can%20ensure%20our%20next%20investigation%20is%20on%20the%20right%20track.%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22YangYu_3-1632332331560.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F312204iEEFD983ECD6D7A55%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22YangYu_3-1632332331560.png%22%20alt%3D%22YangYu_3-1632332331560.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EReferences%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-monitor%2Fapp%2Fasp-net-core%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Application%20Insights%20for%20ASP.NET%20Core%20applications%20-%20Azure%20Monitor%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22x_MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2775376%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3E.NET%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWeb%20Apps%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Co-Authors
Version history
Last update:
‎Sep 22 2021 10:51 AM
Updated by: