none
How to configure ApplicationInsights.config? RRS feed

  • Question

  • I have an existing C# project (includes ASP.net) that I want to use Application Insights with. Using the "JavaScript Usage Analytics Code" I'm able to add my app and see data such as page usage, load time, etc. Now I'm looking to use timedEvents and I've added that to my code. Since this is not a Windows Store App nor Website project, I can't add the project to Application Insight via the context menu, so I've installed the SDK for web services via Nuget. This created a ApplicationInsight.config file for my project that has a few things in it, specifically, it has "ComponentId" set to all zeros with a comment saying to replace it with application ID I got from the Application Insight service. I've tried to replace it with my instrumentation key, but that doesn't seem to work. Also, under the config file in VS it says "Unable to connect to services" even though I'm logged in successfully. How do I set this up properly so I can use timedEvents to log stuff? Right now, when I look at events/events insights, it doesn't show anything.
    Saturday, March 8, 2014 5:00 AM

Answers

All replies

  • When I debug my IIS code, looking at my CurrentRequest object (from ServerAnalytics.CurrentRequest.StartTimedEvent), every prop shows up empty, i..e ApplicationId, AccountId, SessionId, etc. I'm pretty sure I've missed some steps here.

    To summarize, this is what I've done:

    1. In my ASP.net app's master page, I've added the JS code to start AI. This gives me basic page usage data.

    2. I've installed AI SDK for web service, this created some config files for my project.

    3. In CS I'm trying to use StartTimedEvent to log some events.

    4. Page usage shows up, but events don't.

    Thanks!

    Saturday, March 8, 2014 2:28 PM
  • To instrument for server SDK, I believe you need a separate component Id that is specific for server component and not use the one that was generated for JavaScript instrumentation. Have you tried that?

    Monday, March 17, 2014 10:22 PM
  • Sorry, incorrect answer. You should be able to instrument both using the same ComponentID.

    Can you paste the cotents of your applicationInsights.config file?

    Monday, March 17, 2014 11:49 PM