As you know SharePoint 2013 introduces a new development model, known as the App Model, that allows you to create and deploy applications for SharePoint On-Premise and SharePoint Online in Office 365. If you want to know more about how to build applications for SharePoint, I recommend you to visit the Build apps for Office and SharePoint portal created by Microsoft. There you can find a lot of useful information and resources about this new development model, how to build apps, and so on.
As I described in my last entry on the CloudShare Community blog, Microsoft has provided for SharePoint 2013 development the Microsoft Office Developer Tools for Visual Studio 2012. The tools are not only really great and powerful for developing SharePoint artifacts, but also to debug them. In this article I will show you how to debug an application deployed to a SharePoint Online site by using the Windows Azure Service Bus.
Configuring the Windows Azure Bus
In order to debug an autohosted application (Note: This is the name for applications deployed to SharePoint Online in Office 365), you need to create a Windows Azure Service Bus namespace in your Windows Azure subscription:
- Navigate to the Windows Azure portal available at: http://windows.azure.com.
- Once logged in to the Windows Azure portal, go to the Service Bus section.
Create a new namespace by pressing the “CREATE” button at the bottom of the page. Provide a name for it and select a suitable region (West Europe in my case).
Once the namespace is ready and active (the activation takes a few seconds), you need to edit it and copy the connection string to the service bus. Just press the “ACCESS KEY” button at the bottom of the page and select the connection string information.
Just copy this connection string to the clipboard and you are ready to go to the next level: configure your SharePoint Application project to use the Windows Azure Service Bus when doing remote debugging.
Configuring the SharePoint Application Project
In Visual Studio 2012, create an Autohosted SharePoint Application and add some code to it. In order to be able to remotely debug the application:
Through the solution explorer, go to project properties and click the SharePoint tab. Scroll down the SharePoint configuration options until you find the “Enable remote event debugging” option. Just check this option and the connection string to the Windows Azure Service Bus:
Save all the changes, press F5 and wait some seconds until the application is deployed and installed in your SharePoint Online site. Once you access the application, you will see how the debugging is working and how your break points are reached.
For more information about remote debugging using the Windows Azure Service Bus, please read this great post in the Office & SharePoint Apps blog.
And that’s all about how to enable remote debugging to a SharePoint Autohosted application with the Windows Azure Service Bus. Happy CloudSharing!