Microsoft Azure – Remote Debbuging How To?

This article walks you through the steps for remote debug your application on Microsoft Azure. This new feature only works on Visual Studio 2013 with Microsoft Azure SDK 2.2 or higher.

STEP 1 – Install Microsoft Azure SDK for .NET

This could be done through Microsoft Web Platform Installer

Select the option Add on item Azure SDK for .NET (VS 2013) -2.2, and the component will be installed on your machine.

STEP 2 – Create Azure Account

You need to get a Windows Azure account. Everyone can open a Windows Azure account for free.

Check the link below for more information.

http://www.windowsazure.com/en-us/pricing/free-trial/ 

STEP 3 – Create Microsoft Azure Cloud Service

Create a new project on existent solution of type Windows Azure Cloud Service, using the template that is showing on the next image. I call to this project CloudServiceRemoteDebug.

After select the OK button, a new screen will appear to the user. On this sample, we want to create a ASP.NET Web Role,  so select this option, and give it a name.

Press the OK button. After this we need to select on the next screen the type of application. On this demo, we will use MVC as template. So select this option.

STEP 4 – Deploy to Azure activating Remote Debug

In Visual Studio select Solution Explorer and right-click the option “Publish” on the Cloud Service Project. On this dialog, we need to make sure that the application will be built in debug mode, to ensure that we can use the remote debug.

After select the option Publish, a new dialog will appear, with several options to configure.

The first one is the selection of your subscription.

 

After that, when we press the next button, we will need to select our cloud service. Because this is a new one on our subscription, we need to create it. There exists two options to do that. One throw this dialog, and the other one throw the Microsoft Azure Management Portal, where we can manage our subscription.

 

On this demo, we will create it throw the Publish Settings Dialog. So give it a name, and select the region.

 

 

Select the option Debug on Build Configuration setting. Only that way, we will be able to debug remotely our application.

 

 

Selected Advanced Settings tab, make sure we checked “Enable Remote Debugger for all roles”. In WACS, a cloud service could be able to have one or more roles and each role could be able to have one or more instances. The remote debugger will be enabled for all roles and all instances if we checked. Currently there’s no way for us to specify which role(s) and which instance(s) to enable.

 

Finally click “publish” button.

 

To attach remote process, open Server Explorer Window in Visual Studio and expand Cloud Services node. Find the cloud service, role and instance we had just published, right click on the instance and select thw option Attach Debugger.

 

Now, if we put a breakpoint on our code, the debugger  will stop there.

 

Windows Azure Resources

Some good resources about Windows Azure could be found here:

Advertisements

About João Sousa
Senior Software Engineer in .Net (Microsoft Certified MTCS and MCPD). .NET Microsoft MVP 2015

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: