Update to debugging SharePoint 2013 remote events using Visual Studio 2012


Update 5/11/2015: Please note Microsoft Azure Service Bus now supports two types of connection strings: SAS and ACS. In order to use SAS connection string for remote event debugging via Azure Service Bus, please install the latest Office Developer Tools for Visual Studio 2013 or Visual Studio 2015.

———

In “Preview 2” of the Office Developer Tools that we released last October for Visual Studio 2012, we enabled remote event debugging, as detailed in Debugging Remote Event Receivers with Visual Studio. However, using remote event debugging still required a fair bit of configuration.

Now, in the final “RTM” version of Office Developer Tools for Visual Studio 2012 that we released last week, we integrated debugging remote events more deeply into the tooling. You don’t have to follow a long procedure anymore to configure remote event debugging using the Service Bus.

The new remote event debugging options are available on the SharePoint tab under the Properties page of your app for SharePoint project, as shown in Figure 1.

Figure 1. Configure remote event debuggingFigure 1. Configure remote event debugging

All you need to debug remote events is the Service Bus endpoint connection string.

As mentioned in the previous blog post, you’ll need to do the following in order to use the Windows Azure Service Bus for debugging remote events:

1. Register for a Windows Azure account and then create a Service Bus namespace.

2. See Managing Service Bus Service Namespaces for more information about managing namespaces.

3. To get the Service Bus connection string, select your service namespace, click Access Key, and then copy the Connection String.

Once you have enabled remote event debugging and configured the Service Bus connection string, you can debug remote events.

FAQ

1. How can I turn on/off the notification from Visual Studio that tells me when remote event debugging needs to be configured?

If you have a remote event in your project and have not configured remote event debugging, Visual Studio will prompt you to configure remote event debugging (see Figure 2). You can change this behavior by clearing the Notify me if remote event debugging is not configured check box on the SharePoint tab.

Figure 2. - Remote event debugging notificationFigure 2. – Remote event debugging notification

2. When do I need to enable the remote event debugging feature?

You must enable remote event debugging if you want to debug remote event receivers and app events.

3. Do I have to enable remote event debugging for every project?

The remote event debugging setting is saved so that you can reuse the settings across different projects. You configure the setting only once, and then it’s available for all your projects. However, this setting is not saved into source control (TFS).

4. Will I be charged for Service Bus usage?

Yes. Remote event debugging uses the Relay Service component of the Service Bus. Refer to the Service Bus Pricing FAQ for more info.

If you are currently a Visual Studio Professional, Premium, or Ultimate with MSDN subscriber, you can check out the special offer on Windows Azure, which provides Service Bus Relay Hours of up to 1,500, 3,000, and 3,000 respectively.

5. Do I have to change anything in remote event debugging before I publish my app to the marketplace?

No. Our tools turn off remote event debugging when you package your app.

6. Which Service Bus connection string should I use?

Microsoft Azure Service Bus now supports two types of connection strings: SAS and ACS. In order to use SAS connection string for remote event debugging via Azure Service Bus, please install the latest Office Developer Tools for Visual Studio 2013 or Visual Studio 2015. Otherwise, follow the instructions in Service Bus Authentication and Authorization to get an ACS connection string for any new Service Bus namespace created after August 2014.

Comments (13)

  1. Query says:

    Hi Chad,

    I am testing a sharepoint-hosted remote event receiver, how do we debug in this case?

  2. Vishu says:

    I'm getting an error when trying to debug RER using Service Bus Relay endpoint:

    Error:

    ==============================================

    Cannot register AppEventReceiver.svc on Windows Azure Service Bus: The remote server returned an error: (500) Internal Server Error.

    Please guide me what to do next?

    Regards,

    Vishu

  3. @Query – Remote Event Receivers are not support in SharePoint-hosted apps. When you add a RER to a SharePoint-hosted, Visual Studio will add a web project with the web service and change the hosting type of your app for SharePoint to autohosted.

  4. @Vishnu – make sure you have downloaded the latest tools from aka.ms/OfficeDevToolsForVS2012 and follow the steps mentioned above. You shouldn't get this error unless you are disconnected from Internet or your Azure Service Bus connection string is incorrect.

  5. Dylan Nicholson says:

    Is there any information on how to host a remote event receiver on a SP2013 farm such that SharePoint Online/O365 can call it? My SharePoint solution includes an endpoint that implements IRemoteEventReceiver, and I can bring up the .svc page from a browser located outside the LAN (so it's not a firewall issue). I've installed an event receiver pointing to this Url on a Library on my SharePoint online subscription, but it never seems to get called (at least, it's not getting to any my user code).  I've tried setting up an OAuth trust to the SharePoint online farm (so it can authenticate when connecting back to the endpoint) but I suspect I don't really understand how this is supposed to work.

  6. Snehasis Samal says:

    Hi,

    Do we need to create the Windows Azure Service Bus for debugging a Provider-Hosted App also?

    Or

    How to debug the remote event receiver for a provider-Hosted App?

    Please share the URL if any, for creating/debugging/hosting a RemoteEventReceiver for a Provider-Hosted App.

    Thanks id advance..

    Snehasis

  7. XiaoyingGuo says:

    Hi Snehasis,

    It depends on where your app is running. Because the remote event is triggered by SharePoint, and it is the app running on your SharePoint site that needs to find the remote event receiver implemented in your web project, your web project needs to be visible and accessible to your SharePoint site.

    If your app is running on SharePoint Online, while our web project is running at the localhost when debugging, you need to use Microsoft Azure Service Bus to get the app to access your localhost. Otherwise, if your app is running on a SharePoint site locally (e.g. on your machine), or anywhere that can access your localhost, you don't need Microsoft Azure Service Bus.

    To get a Microsoft Azure Service Bus connection string, you need a Microsoft Azure account. Then, you can get the connection string in your Microsoft Azure portal.

    Thanks,

    Xiaoying

  8. kaouther says:

    Hi Xiaoying ,

    I am trying to debug a simple workflow app  I don't know how to use Micrsoft Azure Service Bus  Iam usingin VS 2013 (April update 2)

    Thanks in advance.

    kaouther

  9. Chandara says:

    Myipone4s3g.imei:012538003076523,serial:83101zy8a4s,version:5.1.1(9b206),model:mc603th.

    Can't download,update.software,app,games,ios.newversion.onmobilepone

    Don't open safarifile,server.onmobilepone,Eerror404.unlock

  10. David B says:

    I have remote debugging working on Site1.sharepoint.com.  How can I tell VS2013 to point to Site2.sharepoint.com when debugging?  I can't find any setting for this.  I've created a separate Azure service bus which is associated with Site2, but no luck. Thanks for any help.

  11. David B says:

    Nice article.. But could have been little more brief.

  12. Kenny Bright says:

    As usual bogus information; configuring is only part of the equation, how do you use it in your SharePoint Application would be helpful

  13. Alex says:

    Hi, there are two full step-by-step articles (with information about service bus configuration)  Remote Event Recevers in SharePoint Online:

    1) Creating and Debugging of Remote Event Receivers for SharePoint Online

    blog.virtosoftware.com/…/creating-and-debugging-of-remote-event.html

    2) Adding Remote Event Receivers to list on Host web + Debugging

    blog.virtosoftware.com/…/adding-remote-event-receivers-to-list.html