Hi guys,
I have a default provider-hosted application that prints the site title, when i publish it to my Windows Azure it works great, but, when i publish it to my company server (windows server 2008 R2, iis 7.5) i got this error:
object reference not set to an instance of an object
on TestPHWeb.TokenHelper.GetAccessToken(String refreshToken, String targetPrincipalName, String targetHost, String targetRealm) on TestPHWeb.SharePointAcsContext.RenewAccessTokenIfNeeded(Tuple`2& accessToken, Func`1 tokenRenewalHandler) on TestPHWeb.SharePointAcsContext.GetAccessTokenString(Tuple`2&
accessToken, Func`1 tokenRenewalHandler) on TestPHWeb.Default.Page_Load(Object sender, EventArgs e)
My code:
var spContext = SharePointContextProvider.Current.GetSharePointContext(Context);
using (var clientContext = spContext.CreateUserClientContextForSPHost())
{
clientContext.Load(clientContext.Web, web => web.Title);
clientContext.ExecuteQuery();
Response.Write(clientContext.Web.Title);
}
I'm not using WebDeploy to publish it, i'm using 'File System' and copying files to my IIS folder.
It's a provider-hosted app for SharePoint Online (o365) using VS2013
Someone knows what if happening?
Thanks for your time.