Instrumenting windows service with Application Insights

6.3k views Asked by At

Is it possible to instrument a windows service running on premise with Application Insights? It's not necessary to have it automatically collecting metrics of the application like it does with Web applications, pushing custom events to Azure would suffice.

3

There are 3 answers

2
Alan Wills -MSFT On BEST ANSWER

I'll make the docs a bit more clear on this. You can instrument anything if there's a core SDK that will build with it. So any kind of .NET, Java, PHP, OSX, iOS, Android, .... If you want additional modules that log web requests, crashes, etc, you're a little bit more restricted.

For Windows Services on premises, follow what you see here: https://learn.microsoft.com/en-us/azure/application-insights/app-insights-windows-desktop

0
Anastasia Black On

Install Core SDK nuget. Then create TelemetryClient, set instrumentation key programmatically and start sending telemetry from places you want. Msdn article describes how to use AI API. There will be no autocollection but everything should work.

3
Lukas Spieß On

This totally possible! Quoting the Application Insights web page:

Monitor ASP.NET or J2EE web apps hosted anywhere: on Azure, or on other cloud services, or your own on-premises servers

You just need to create an instrumentation key on the Azure Portal and integrate the matching SDK into your app. Then the actual telemetry data is sent to the backend servers which are hosted as part of Azure.