Using IntelliTrace to Diagnose Problems with a Hosted Service

Realize the full potential of Windows Azure with this superb Cookbook that has over 80 recipes for building advanced, scalable cloud-based services. Simply pick the solutions you need to answer your requirements immediately.


Microsoft Windows Azure Development Cookbook

Microsoft Windows Azure Development Cookbook

Over 80 advanced recipes for developing scalable services with the Windows Azure platform

        Read more about this book      

(For more resources on this subject, see here.)

Windows Azure Diagnostics provides non-intrusive support for diagnosing problems with a Windows Azure hosted service. This non-intrusion is vital in a production service. However, when developing a hosted service, it may be worthwhile to get access to additional diagnostics information even at the cost of intruding on the service.

The Visual Studio 2010 Ultimate Edition supports the use of IntelliTrace with an application deployed to the cloud. This can be particularly helpful when dealing with problems, such as missing assemblies. It also allows for the easy identification and diagnosis of exceptions. Note that IntelliTrace has a significant impact on the performance of a hosted service. Consequently, it should never be used in a production environment and, in practice, should only be used when needed during development.

IntelliTrace is configured when the application package is published. This configuration includes specifying the events to trace and identifying the modules and processes for which IntelliTrace should not capture data. For example, the Storage Client module is removed by default from IntelliTrace since otherwise, storage exceptions could occur due to timeouts.

Once the application package has been deployed, the Windows Azure Compute node in the Visual Studio Server Explorer indicates the Windows Azure hosted service, roles, and instances which are capturing IntelliTrace data. From the instance level in this node, a request can be made to download the current IntelliTrace log. This lists:

  • Threads
  • Exceptions
  • System info
  • Modules

The threads section provides information about when particular threads were running. The exceptions list specifies the exceptions that occurred, and provides the call stack when they occurred. The system info section provides general information about the instance, such as number of processors and total memory. The modules section lists the loaded assemblies.

The IntelliTrace logs will probably survive an instance crash, but they will not survive if the virtual machine is moved due to excessive failure. The instance must be running for Visual Studio to be able to download the IntelliTrace logs.

In this recipe, we will learn how to use IntelliTrace to identify problems with an application deployed to a hosted service in the cloud.

Getting ready

Only Visual Studio Ultimate Edition supports the use of IntelliTrace with an application deployed to a hosted service in the cloud.

How to do it...

We are going to use IntelliTrace to investigate an application deployed to a hosted service in the cloud. We do this as follows:

The first few steps occur before the application package is deployed to the cloud:

  1. Use Visual Studio 2010 Ultimate Edition to build a Windows Azure project.
  2. Right click on the Solution and select Publish....
  3. Select Enable IntelliTrace for .Net 4 roles.
  4. Click on Settings... and make any changes desired to the IntelliTrace settings for modules excluded, and so on.
  5. Click on OK to continue the deployment of the application package.

The remaining steps occur after the package has been deployed and the hosted service is in the Ready (that is, running) state:

  1. Open the Server Explorer in Visual Studio.
  2. On the Windows Azure Compute node, right click on an instance node and select View IntelliTrace logs.
  3. Investigate the downloaded logs, looking at exceptions and their call stacks, and so on.
  4. Right click on individual lines of code in a code file and select Search For This Line In IntelliTrace.
  5. Select one of the located uses and step through the code from the line.

How it works...

Steps 1 through 5 are a normal application package deployment except for the IntelliTrace configuration.

In steps 6 and 7, we use Server Explorer to access and download the IntelliTrace logs. Note that we can refresh the logs through additional requests to View IntelliTrace logs.

In steps 8 through 10, we look at various aspects of the downloaded IntelliTrace logs.

Further resources on this subject:

Books to Consider

comments powered by Disqus