How to Debug Microsoft Windows Azure Applications
Introduction to Debugging Windows Azure Apps
The ability to debug applications is important for developers. Be it developing for staging or production, the ability to debug applications enables developers to track and fix issues to make their applications reliable and high-performance.
Microsoft Windows Azure developers can run into two main categories of situations where they would need to use the debugger: during development and in the cloud.
While writing their application, they can use the Azure emulator and Visual Studio to debug their code.
When their code is running in the cloud, they can execute diagnostic logging code which can help emit information about application performance.
Toolset: Visual Studio and Azure SDK
To debug a Microsoft Windows Azure application, you will need to have Visual Studio 2010 as well as the Microsoft Azure SDK installed. If you don't have a paid edition of VS2010, you can grab a free copy of Visual Web Developer 2010 Express.
Hands-On Azure Debugging at Development Time
If you are debugging a Microsoft Windows Azure application while you are writing code, you can use the emulator.
To show the emulator, you need to start debugging your application. If you do not have an Azure application, you can download the attached sample and fire up Visual Studio (elevated).
To launch the emulator, go to system tray and right click on the Compute Emulator and choose "Show Compute Emulator UI".
This will pop-up the Windows Azure Compute Emulator.
You can click on the Role to see the logging provided.
You can see all your custom tracing here if you click on the appropriate node. The experience of debugging a Windows Azure application is similar to that of debugging an ASP.NET application or a web-service.
Debugging a Hosted Azure Application with IntelliTrace
If you want to debug an in-production cloud application, you can use the IntelliTrace feature (available only on 64 bit Visual Studio installations and for Windows Azure applications built against .NET 4.0). If you are using a 32-bit instance of Visual Studio 2010, you will need to install QFE. To ensure that your Microsoft Windows Azure application supports IntelliTrace, you need to make some changes in the default when you are publishing the project.
In the above screen (which you can reach by right-clicking on the Project and selecting Publish, you need to ensure that the checkbox for "Enable IntelliTrace for .NET 4 roles" is enabled.
If you click the Settings link next to the option, you can configure advance settings, like collecting events only or both events and call information.
There are also options for the type of IntelliTrace events you want to be collected.
The default size of the log file is only 250GB so if you are planning exhaustive logging (in a circular buffer), make sure you set the size of the logging in the Advanced tab.
Once your publish the application with IntelliTrace enable, you can connect to the Azure Compute instance from the Server Explorer window of Visual Studio and download your logs.
Summary: Debugging Windows Azure Applications
In this article, we saw the available debugging options for Microsoft Windows Azure platform.
About the author
Vipul Patel is a Software Engineer currently working at Microsoft Corporation. He is currently working in the Office Communications Group and has worked in the .NET team earlier in the Base Class libraries and the Debugging and Profiling team. He can be reached at vipul_d_patel @ hotmail.com