1

I was successfully able to install and publish (using publishing wizard) a provider-hosted app on sharePoint 2016 server. However, upon accessing the app I am getting a nullReferenceException on SharePointAcsContentProvider like below:

[NullReferenceException: Object reference not set to an instance of an object.]
   AppSshWeb.SharePointAcsContextProvider.LoadSharePointContext(HttpContextBase httpContext) in c:\users\ssh\source\repos\AppSsh\AppSshWeb\SharePointContext.cs:738
   AppSshWeb.SharePointContextProvider.GetSharePointContext(HttpContextBase httpContext) in c:\users\ssh\source\repos\AppSsh\AppSshWeb\SharePointContext.cs:478
   AppSshWeb.SharePointContextProvider.CheckRedirectionStatus(HttpContextBase httpContext, Uri& redirectUrl) in c:\users\ssh\source\repos\AppSsh\AppSshWeb\SharePointContext.cs:328
   AppSshWeb.SharePointContextProvider.CheckRedirectionStatus(HttpContext httpContext, Uri& redirectUrl) in c:\users\ssh\source\repos\AppSsh\AppSshWeb\SharePointContext.cs:395
   AppSshWeb.Default.Page_PreInit(Object sender, EventArgs e) in c:\users\ssh\source\repos\AppSsh\AppSshWeb\Pages\Default.aspx.cs:15
   System.Web.UI.Page.OnPreInit(EventArgs e) +125
   System.Web.UI.Page.PerformPreInit() +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1137

What could be the reason for this error? Should there be any service running on the server?

I have a hosted sharePoint server for my company, but I am still using the "Windows Azure Access Control Service" for the authentication settings. Is it the case that I must use a high-trust authentication ("Use a certificate (for ShrePoint on-premises add-in using high trust) mechanism? Thanks in advance.

[Updated]

Upon digging deeper, I found that the error is in the following code lines

    if (StringComparer.OrdinalIgnoreCase.Equals(httpContext.Request.HttpMethod, "POST"))
    {
        return RedirectionStatus.CanNotRedirect;
    }

I read a few articles online but no much help. Do I need to include certain special permissions for the app? Currently, I have not included any permissions in the AppManifest.

3
  • Try to trap the error in VS, so you know which line is causing the error and can provide more details.
    – jpollar
    Commented Jun 18, 2018 at 16:51
  • @jpollar: I have updated my question. Do you have any idea?
    – Shobhit
    Commented Jun 18, 2018 at 18:32
  • Looks like your problem is similar to this one. sharepoint.stackexchange.com/questions/85190/…
    – jpollar
    Commented Jun 18, 2018 at 18:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.