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.