Microsoft & .NETVisual C#How to Debug Microsoft Windows Azure Applications

How to Debug Microsoft Windows Azure Applications

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

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”.

Figure 1

Figure 2

This will pop-up the Windows Azure Compute Emulator.

Figure 3

You can click on the Role to see the logging provided.

Figure 4

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.

Figure 5

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.

Figure 6

There are also options for the type of IntelliTrace events you want to be collected.

Figure 7

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.

Figure 8

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

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories