How to: Remotely debug an Azure Web APP?
This post is in continuation of the post where I have explained how to host an Azure web app. In this post, I am going to show how to debug an Azure web app remotely. For the demo purpose, I have created a new web project and published the website on Azure following the steps in the post with one difference. For this demo, I have hosted the web app using Debug profile (and not Release profile) as we want to remotely debug website.
To start with, I am going to use Visual Studio 2015 Update 3. Below are the steps for remote debugging:
- Create and host the web app from Visual Studio.
- Open the web application project in the Visual Studio, if not already, and then go to View -> Cloud Explorer
- Click on “Connect to Microsoft Azure” link. Please login with your Azure Account. If you have signed into Visual Studio with the same credentials before, it might login automatically or else, might ask to reenter the credentials.
- Once you have successfully logged in, you can select the check box for the subscription which has the web app.
- Click on Apply. You should be able to see all your Azure Resources. Look out for the node for Web Apps. Expand it and right click on the web app you want to debug. Click on “Attach Debugger”.
- It will trigger the remote debugging.
- If you see the below message, republish your webapp under debug profile as stated before:
- Once the web app is opened in the browser, set a breakpoint in your code in Visual Studio and browse the site in the browser. In the demo, I have set a breakpoint in Home Controller on About Action Method.
- When we click on About menu, it triggers the breakpoint. ————————————————————-
Microsoft has made debugging an Azure web app very simple from Visual Studio. Hope the steps shown in this post will be helpful to the reader!