Friday, January 18, 2019

SharePoint provider hosted app: Error occurred

While trying to work with a provider hosted app, we sometimes get the error:

An error occurred while processing your request

There are several possible reasons for this error,  see Chris O'brian's blog for more details:

https://www.sharepointnutsandbolts.com/2015/07/errors-in-sharepoint-apps-add-ins.html.

He has mentioned some important files on SharePoint server like 
AppRegNew.aspx - Used to register a new provider hosted app
AppInv.aspx - Assign permissions, or view details of an already registered app
AppPrincipals.aspx - View or delete app principles registered on the SharePoint site

In my project I did the following changes to solve this error.


  1. Change app web site url from http to https in Project Properties window


2. In solution properties set Startup Project to 'Multiple startup projects' and action to 'Start' for both add in project and app web project


3. In app web project property pages set start action to 'Wait for a request from external application'


4. Make sure AppManifest.xml has {StandardTokens} appended to app web url


5. If a secondary client secret has been specified, make sure length of its value is divisible by four. '=' can be used as padding character.


No comments:

c# httpclient The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch

 If we get this error while trying to get http reponse using HttpClient object, it could mean that certificate validation fails for the remo...