Debugging SharePoint Online Provider Hosted App Remote Event Receivers


This post is a contribution from Charls Tom Jacob, an engineer with the SharePoint Developer Support team

Update on 30-Apr-2014: Note: SAS Service Bus connection strings have been supported in Visual Studio 2015 RC and Office Developer Tools for Visual Studio 2013 – April 2015 Update for SharePoint remote event receiver debugging.

If you are finding it difficult to debug your remote event receiver, most probably you would be using an incorrect connection string to connect to the Microsoft Azure Service Bus. Visual Studio Error List will show

“Cannot register Services/RemoteEventReceiver1.svc on Microsoft Azure Service Bus: The remote server returned an error: (500) Internal Server Error.”

Important point to note here is:

Microsoft Azure Service Bus supports two types of connection strings: SAS and ACS. For remote event debugging via Azure Service Bus, the only connection string currently supported is ACS. 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

Ref: http://msdn.microsoft.com/en-us/library/office/dn275975(v=office.15).aspx

You can use Microsoft Azure Powershell to setup an Azure Service Bus Namespace as below:

PS C:\> New-AzureSBNamespace rerdebug 'East US' -CreateACSNamespace 1

Which gives you the following output:

Name : rerdebug

Region : East US

DefaultKey : LlN5g56H1DViQ4eH/nEtE879MANXk+KuVQFX3e4Vk2M=

Status : Active

CreatedAt : 10/3/2014 5:33:38 PM

AcsManagementEndpoint : https://rerdebug-sb.accesscontrol.windows.net/

ServiceBusEndpoint : https://rerdebug.servicebus.windows.net/

ConnectionString : Endpoint=sb://rerdebug.servicebus.windows.net/;SharedSecretIssuer=owner;SharedSecretValue=LlN5g56H1DViQ4eH/nEtE879MANXk+KuVQFX3e4Vk2M=

Set the value for “Endpoint=” highlighted above as your connection string and you should be good to go!

When connected successfully, you will find the following in the Visual Studio output window:

“Services/RemoteEventReceiver1.svc has been registered on Microsoft Azure Service Bus successfully”

Note: If you find that debugger is properly attached but breakpoints are never hit, make sure that you are performing the action (adding list or list item) in the App Web, not the Host Web. Remote event receivers FAQ


Comments (3)

  1. Joe Zhou says:

    Thank you very much for this. Searched high and low and finally found this. By the way for the future readers, the command has changed with a new parameter "-NamespaceType" such as New-AzureSBNamespace -NamespaceType Messaging -Name xyzltd -CreateACSNamespace
    $true -Location ‘West Europe’.

  2. Kenny Bright says:

    Things are configured correctly; am using service bus, Office SharePoint App, Azure Website (Web Application).
    The App get deployed and works but events are not firing. I can see in Fiddler that there is a redirection from Office 365 to the site. Neither the App Installed or the App RemoteEventReceiver are firing.

    By the way you doing really have to use PowerShell as stated above you can use Azure web UI to create a ServiceBus Namespace

Skip to main content