Troubleshooting SharePoint Remote Event Receiver

Recently I have worked with customer on SharePoint Remote Event Reciever (RER) issue. The app is keep trying to install and throwing error in few seconds. Customer has hooked the App Installed event. The provider hosted app has been configured in different server (it does not matter).

Though Customer has already added custom logging mechanism in “publicSPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties)” nothing has been generated, Which gave me the clue that it is failing well before.

1. Analyzed the ULS log and make sure the call to RER service has been triggered

2. Analyzed the IIS log file on RER server and found that IIS   is getting a hit from SharePoint and calls to Services/AppEventReceiver.svc is recorded

 3. Then to get more info, enabled the FREB log to trace the WCF calls for status code 100-600. (Seehow to enable FREB here).
 

4. Going thru FREB log, As expected it has failed in IIS pipe line

5. Navigated to “Compact View” in FREB xml file and Looked at GENERAL_REQUEST_ENTITY & “GENERAL_RESPONSE_ENTITY_BUFFER” event which recorded the Request SOAP from SharePoint and Response SOAP from RER

6. Since “includeExceptionDetailInFaults” has not been enabled on RER side, it is showing “The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order
to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs"

7. Injected the below highlighted xml block to web.config of RER and tried to install the app again.

<system.serviceModel>
<bindings>
<basicHttpBinding>
<!--Used by app for SharePoint-->
<binding name="secureBinding">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<protocolMapping>
<add binding="basicHttpBinding" scheme="https" bindingConfiguration="secureBinding"/>
</protocolMapping>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>

 

 

 

8. It has now included the exception stack trace with where it is failing

9. Fixed the issue.