0
votes

I am trying to record requests from a ServiceFabric into Application Insight and have no success.

I have build two apps, one .NET Core 2.1 WebApi with configured Application Insight resources and correct instrumentation key. When I debug it, the requests/exceptions are stored in the Azure application insights.

Then I have a basic website at ServiceFabric. It has same packages and is configured with same application insights resource, but I never see any requests/exceptions from the SF application in the Application Insights.

Both applications say that I am 100% configured (menu Project->Application Insights->Configure Application Insights...) and both use jahav-voting-ai (resource) in voting-rg (resource group).

I have tried to troubleshoot with the https://docs.microsoft.com/en-us/azure/application-insights/app-insights-asp-net-troubleshoot-no-data but no success (probably because I am very new to both SF and AI).

The Service Fabric project doesn't have Microsoft.ApplicationInsights.ServiceFabric.Native as described in the tutorial, I have tried it but it didn't help at all.

Basically I don't know what is missing from the the most basic .NET Core SF project to make it record requests/exceptions to AI.

I have found several projects that use .NET Framework (that work and record requests/exceptions to AI), but nothing for .NET Core.

The archive with both projects.

1

1 Answers

0
votes

TL;DR: Add .UseApplicationInsights() to the WebHost building so the Application Insights will be integrated to the OWIN pipeline.

There is a difference in how the Cloud -> ASP.NET Core Web Application template and the Cloud->Service Fabric Application template behaves when user adds the Application Insight telemetry.

The project created from the Cloud -> ASP.NET Core Web Application template will have .UseApplicationInsights() added to the BuildWebHost() method in the Program.cs, whereas the project created from the Cloud->Service Fabric Application template won't.

Therefore, the .NET Core project hosted in Azure did collect telemetry and the Service Fabric didn't. The difference is the missing directive to use application insights while building the web host.