#StackBounty: #sharepoint-online #development #azure #remote-event-receiver Remote event receiver stop working after deploying them ins…

Bounty: 100

I am developing a remote event receiver for our SharePoint online dev site. i followed the following steps:-

1- As mentioned in this link https://derekgusoff.wordpress.com/2017/11/08/remote-event-receivers-youre-all-doing-it-wrong/ i created a new asp.net web application inside VS 2019 + i add a WFC service to it.

2- Inside the service i added the following test code, to update the item title, as follow:-

public SPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties)
            SPRemoteEventResult result = new SPRemoteEventResult();
            //if using App Only Context, use this method, and make sure ClientId and ClientSecret are specified in AppSettings
            using (ClientContext context = Helpers.GetAppOnlyContext(siteUrl))
                result.ChangedItemProperties.Add("Title", "After adding");
                result.Status = SPRemoteEventServiceStatus.Continue;
            return result;  

3- i run the ngrok to debug the RER:-

Run ngrok command :- ngrok --http-header=rewrite 53938

4- i register the RER inside the Dev site @/sites/dev2/_layouts/15/appregnew.aspx

5- i update the web.config with the generated clientId and clientsecret from step number 4.

6- i Add the RER, using this power-shell command:

Add-PnPEventReceiver -List "12" -Name "TasksRER" -Url http://4f9922f3.ngrok.io/service1.svc -EventReceiverType ItemAdding -Synchronization Synchronous

7- i add the app permission using this sharepoint admin site url https://***admin.sharepoint.com/_layouts/15/appinv.aspx, as follow:-

<AppPermissionRequests AllowAppOnlyPolicy="true">
 <AppPermissionRequest Scope="http://sharepoint/content/tenant" Right="FullControl" />

8- i run the VS project and the RER worked well..

9- now i wanted to deploy the RER to azure >> so i create a new azure web app >> generate a zip file for the project inside VS >> and deploy the zip inside the azure web app using kudu drag/drop, and i can access the service inside azure as follow:-

enter image description here

10- i re-register the RER using the azure url instead of the ngrok url, as follow:-

Remove-PnPEventReceiver -List 12 -Identity TasksRER

Add-PnPEventReceiver -List "12" -Name "TasksRER" -Url https://****.azurewebsites.net/service1.svc -EventReceiverType ItemAdding -Synchronization Synchronous

but when i add a new item, nothing happen, where seems the RER did not get fired. so can anyone advice what might be the problem?


here is a screen shot for the appinv:-

enter image description here


I download the eventlog.xml from Kudu, and i can see this error inside it:-

System.Web.HttpException (0x80004005): The service '/service1.svc' does not exist. ---> System.ServiceModel.EndpointNotFoundException: The service '/service1.svc' does not exist. at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath, EventTraceActivity eventTraceActivity) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest() at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest() at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)

But i am not sure why it is saying service1.svc does not exists. as inside kude i can find it as follow:-
enter image description here

Also as i mentioned above if i navigate to @ https://**azurewebsites.net/service1.svc, i will get the service as follow:-
enter image description here

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.