I am trying to deploy a provider-hosted sharePoint add in visual studio 2017 and sharePoint 2016. I have successfully created a Publish Profile using the clientID and secretID. The connection to the server is also validated successfully and the app is published as well. But when I deploy (Using Start) the whole deployment get stuck at "Communicating with SharePoint...".
After a while, I can see the app link on the sharePoint site (Visual Studio is still stuck at 'Communicating with SharePoint') and when I click on it I get the following stacktrace
Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [NullReferenceException: Object reference not set to an instance of an object.] TestAppWeb.SharePointAcsContextProvider.LoadSharePointContext(HttpContextBase httpContext) in C:\Users\ssh\source\repos\TestApp\TestApp\TestAppWeb\SharePointContext.cs:738 TestAppWeb.SharePointContextProvider.GetSharePointContext(HttpContextBase httpContext) in C:\Users\ssh\source\repos\TestApp\TestApp\TestAppWeb\SharePointContext.cs:478 TestAppWeb.SharePointContextProvider.CheckRedirectionStatus(HttpContextBase httpContext, Uri& redirectUrl) in C:\Users\ssh\source\repos\TestApp\TestApp\TestAppWeb\SharePointContext.cs:328 TestAppWeb.SharePointContextProvider.CheckRedirectionStatus(HttpContext httpContext, Uri& redirectUrl) in C:\Users\ssh\source\repos\TestApp\TestApp\TestAppWeb\SharePointContext.cs:395 TestAppWeb.Default.Page_PreInit(Object sender, EventArgs e) in C:\Users\ssh\source\repos\TestApp\TestApp\TestAppWeb\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
I already saw the link but this didn't help me.
I have no idea on how to proceed from here. Thanks in advance.