Monitor web service health

Application Insights is in preview.

Use Application Insights to diagnose performance problems and exceptions in your web app.

(The steps given here work if you have an ASP.NET web app and you have full access to your web server machine. Go to the alternative instructions if your service runs as a web role in Microsoft Azure or it is a Java web app.)

  1. If you haven't added Application Insights to your web app project, do that now.
    (But if you don't want to modify your project, you can set up performance monitoring independently.)

  2. Deploy your app to your server.

  3. Open Application Insights. You can do that from your web app project.
    In Solution Explorer, right-click your project and choose Open Application Insights 
  4. Go to the PERFORMANCE page and select your application.
    Go to PERFORMANCE and select your app  

  5. If you previously installed Microsoft Monitoring Agent on your web server, you don't need to do anything else. Skip this step and watch for performance data.
    To install Microsoft Monitoring Agent on your web server, download it from the PERFORMANCE page.
    Copy it to your web server, and run it there with administrative permissions.
    Don't download ApplicationInsights.config. Do install MMA on your server.
    But don't download ApplicationInsights.config - you already have a copy of it in your project.

  6. After about 20 minutes, performance counters and metrics will show up. After your app has been in use for some time, a typical chart will look like this:

    The server performance tab on the perfomance page, with the app selected
    Make sure to select your app in the drop-down list.
    If no data appears, see Troubleshooting.
  7. If your app throws exceptions or crosses performance thresholds, you'll see data in the DIAGNOSTICS pages.

  8. Set up an alert so that you'll know when your app's performance doesn't meet your expectations.

    Diagnostics menu, Metrics tab, Configure Alert link
  9. Set the alert details.

    Edit alterting dialog

    You'll hear from us if your app's performance fails to meet your criteria.

Q&A

Q:Can I adjust the time period that the performance chart covers?

A:Yes.

  1. Set the date range.

    Selected date range on the server performance tab of the performance page
  2. Drag across the smaller summary chart to zoom in or out.

    Zooming in the summary chart on the server performance tab of the performance page

Q: How do I use Application Insights to tune my app's performance?

A:

  • If you see performance events, open the events and investigate the stack traces to see which functions used most time.
  • If you don't see many performance events, edit ApplicationInsights.config in the root folder of your website and reduce <PerformanceThreshold> to the point where more requests generate events. Upload ApplicationInsights.config to your web server for the changes to take effect.

Q: How can Application Insights help me diagnose and find bugs?

A:

  • Any exceptions that are not caught by your app are reported on the DIAGNOSTICS page. Open the event to investigate the stack trace.
  • If you have configured deployment markers you can open the events in Visual Studio, and see the stack trace in the context of the appropriate version of the code - even if you changed the code since the deployment.
  • To have the parameter values of a particular function reported in a stack trace, edit  ApplicationInsights.config and add the qualified name of the function in <Resources>.
  • Compare stack traces to find memory leaks.
  • Quickly search logs generated from your favorite diagnostic logging framework (such as TraceListener, Log4Net or NLog).
  • Theperformance charts show each deployment, so that you can see how each update affected performance.

Q: How do I get notified about exceptions and drops in performance as soon as they occur?

A:Configure notifications.

Try this next