1
votes

I'm trying to add Azure Application Insights to my .NET Core App so I can see search traffic analytics but I only keep finding documentation on how to set this up for an ASP.NET App, is setting Azure Application Insights possible for a .NET Core App?

Thanks for your time,

3
Is this a .net core console app or .net core web app?Ivan Yang

3 Answers

0
votes

It's the same way you do for ASP.NET app. Did you have a chance to look at Start Monitoring Your ASP.NET Core Web Application which includes the same steps

  • Create AppInsights
  • Enable AppInsights
  • Configure App Insights SDK
0
votes

Open your project in Visual Studio, right click in project you want to add the Application insights and click Publish. Go to Connected Services, inside Service Dependencies, click Add Dependency and select Application Insights Sdk (Local) as shown in the screenshot below.

enter image description here

Click Next then click Finish to install the required Nuget packages and you're done.

0
votes

An overall solution that would work locally, on Windows and on Linux (On Linux is currently on preview in azure but this would work) environments is:

  1. Create an Application Insights account.
  2. Install Microsoft.ApplicatoinInsights.AspNetCore nuget
  3. Use DI,you need to register application insights client into the service collection. You can find a very good example on how to do it an Andrew Lock's blog
  4. Register ApplicationInsights telemetry. It will work out of the box for you later on. enter image description here
  5. Add "ApplicationInsights" in your appsettings file, and "InstrumentationKey" inside it (Instrumentation key can be found in the overview tab of your resource) enter image description here

Now if you run your application you will be able to capture all traffic in your application insights account.