Troubleshooting Application Insights

Visual Studio 2013

Most problems you might encounter with Application Insights are about setting up and getting things working. Here are some tips to help you solve the most common issues.

Application Insights has a newer version that is part of Microsoft Azure, and an older version that is part of Visual Studio Online (VSO). The topics in this part of the MSDN Library are about the VSO version.

For new projects, the better experience will be with the Azure version. You get that automatically if you install Visual Studio 2013 Upgrade 3 or later.

For existing projects that already have Application Insights, it’s easier to stay with the VSO version. You can still use the latest upgrade of Visual Studio to work with it.

There are two ways in:

  • Start from Visual Studio 2013. Install Application Insights Tools for Visual Studio, and then add Application Insights to your web app, Windows Phone, or Windows Store project. Pick the instructions for your type of application under Start monitoring an ASP.NET application or web site.

    Adding Application Insights to your project lets you see data about what your users are doing with your app. If it’s a web application, or if part of it is a web service, your next steps can be to add performance monitoring and Monitor your web app's availability and responsiveness.

  • Start from the Application Insights portal. If your team has a Visual Studio Online account, just go to http://< your team account> and choose the Application Insights tile. The first time you do this, you’ll see instructions for monitoring an application. This is an easier way in if you have Visual Studio 2012.

If your team already has an account, they should add you as a member. Otherwise, set up a new team account.

You don’t have to. You need the account in order to use Application Insights, but you can use your local on-premises tools to manage your work. When you sign in to your Visual Studio Online account, just choose the Application Insights tile without setting up a Visual Studio Online project.

To install the Tools, you have to have Visual Studio 2013.

If you’re using Visual Studio 2012, you can use Application Insights, but there are a few extra steps to get started.

In Visual Studio 2013, in the Tools menu, choose Extensions and Updates. Select Online, and then enter the search string “Application Insights” (with the quotation marks).

You can still monitor the performance of your web app if it runs in your own server or VM (not as a Microsoft Azure web role) and monitor the availability of your website. You won’t be able to analyze usage patterns.

You can still analyze how your app is being used and monitor the availability of your website. You won’t be able to monitor your web app’s performance or search diagnostic logs with Application Insights.

To view the Application Insights portal, you need Internet Explorer 10 or later, Safari 4 or later, or either of the latest two releases of Chrome or Firefox.

By installing the Application Insights SDK in your app project, you get data on the USAGE pages that show you what people are doing with your app.

In the Application Insights web portal. You can open it from Solution Explorer.

Project menu: Open Application Insights in Portal

You should see data:

  1. Immediately, in the DIAGNOSTICS/Streaming data page (if you are using the Application Insights Tools for Visual Studio 2013).

  2. In 5-15 minutes, in the USAGE pages.

It takes 5-15 minutes for data to appear in the USAGE pages. Instead, watch for data Raw event stream tile on the dashboard. Data appears there within a few seconds.

Data stream tile on the default dashboard

Or you can see more detail on the Diagnostics, Streaming Data page.

Debug data in DIAGNOSTICS, Streaming

Once you see data in the raw event stream, the Usage pages show aggregated data about 15 minutes later.

Check that you’re configured for streaming.

  • You have to install Application Insights Tools for Visual Studio 2013 in order to see streaming data. If you are using Visual Studio 2012, wait 5-15 minutes to see data in the Usage pages.

  • In Visual Studio, on the Build menu, open Configuration Manager. Check that the Active Build Configuration is Debug.

  • Open ApplicationInsights.config in the root folder of your app project and check the following elements:

    • This element determines which profile that is active when you build in Debug mode:


    • Inside <Profile name="Development">, check that you see these elements:

      <ServerAnalytics enabled="true"> <!-- or ClientAnalytics for Windows Store and Phone apps -->

(I don’t see data in the Streaming page; or I know that I’m not configured for raw event streaming, but I don’t see data in USAGE even after 15 minutes.)

  1. [Windows Store apps] On the device, make sure that Advertising is enabled.

    Open the Settings charm, choose Change PC Settings, Privacy, and then enable Let apps use my Advertising Id.

  2. Watch the debug output. The SDK logs messages to the Debug Output window in Visual Studio. You should see initialization messages, followed by messages when events are logged and sent.

    [Windows Phone and Store apps] To see the SDK log messages:

    1. Open the properties of your Windows Phone or Store app project.

      In the Debug page, [Phone] change UI Task to Native Only, or [Store] change Debugger Type to Native or Mixed (Managed and Native).

    2. Run your app in debug mode. To filter out all but the Application Insights messages, open the context menu of the Output window, and disable all types of messages except Program Output.

    Debug output from server SDK running in F5

  3. [Windows Store and Phone apps] Make sure you don’t send call logging methods before InitializeComponent() in the App constructor.

It stopped updating? Refresh the page. If your app sends no data for 90 seconds, the polling interval of the raw event view gradually increases to 30 minutes. It will speed up again after a poll that sees new data, or if you refresh the page.

Old data vanished? The raw event stream keeps the events only for two hours, and has a limited size, so you won’t be able to scroll back to old individual events. But you will be able to see the aggregated events in the USAGE pages.

You can have at most one numeric parameter. If you have more than one, convert the others to strings.

Add following to configurations section of web.config or to the app.config. Make sure that sufficient permissions for tracing are provided on the folder specified below. Other listeners can be also added. See DiagnosticMonitorTraceListener and System.Diagnostics.TraceListener.

<trace autoflush="true"></trace>
<source name="Microsoft.ApplicationInsights.Telemetry.Services" switchValue="All">
<add name="DiagnosticMessageTraceListener"
traceOutputOptions="ProcessId, ThreadId, DateTime"
initializeData="location of the log file" />

  1. Run your app and then terminate it.

  2. You can find log files under %localappdata%\Packages\*\LocalState\MS.CA

    However, be aware that the log files are deleted as soon as they are sent. Logs are sent on startup or resume, and so it can be particularly difficult to see events that are generated on launch. If you want to see launch events, you might want to disable the device’s network.

  1. Install a tool that allows you to inspect the Windows Phone isolated storage, such as Windows Phone Power Tools, IsoStoreSpy, or Isolated Storage Explorer.

  2. Run your app and then terminate it by using the back button.

  3. Use the tool to inspect the phone’s isolated storage.

    You should see log files under the Microsoft.ClientAnalytics folder.

    However, be aware that the log files are deleted as soon as they are sent. Logs are sent on startup or resume, and so it can be particularly difficult to see events that are generated on launch. You might want to disable the phone’s network to be able to see those events.

Under the PERFORMANCE pages in Application Insights, you can get reports that tell you if your web service throws exceptions or has performance issues. Assuming you followed the instructions to set up performance monitoring, here are some tips for fixing the most common issues.

  1. Try the drop-down menu of application components. If there are other names in the menu, look to see if the data is appearing there.

    Select another application component name

  2. Wait 5 minutes and then refresh the page.

  3. Do you have two applications on the server with the same component name? Open ApplicationInsights.config in the root folder of each web app and make sure <ComponentName> is different in each one.

  4. Do you have two applications on the server that are configured to send data to different Application Insights accounts? Open ApplicationInsights.config in the root folder of all the web apps and make sure that <AccountID>, <LicenceKey> are the same in every one.

    Microsoft Monitoring Agent can only send data to application components in one Application Insights account. If you decide to use the first account, change the AccountId and LicenceKey in ApplicationInsights.config. To see the data, you’ll have to log into that Visual Studio Online account. If you decide you want to change to the new account, open the Microsoft Monitoring Agent control panel to reset the default account credentials, and then either remove the old ApplicationInsights.config, or change its credentials.

ApplicationInsights.config in the root folder of your web app. Change <ComponentName> to be the name under which the USAGE data appears. Upload the edited file to your web server.

When the data appears in the right place, you can delete the old application component under Overview, Applications.

Data is only sent if your web service throws exceptions or crosses performance thresholds. You must be using your web service for this to happen.

If you reduce the threshold, you’ll see more data. In ApplicationInsights.config in the root folder of your web app, reduce <PerformanceThreshold>. Upload the edited file to your web server.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft