The (very important) APP DOMAIN

SharePoint error : An error occurred while processing your request

I’ve just trying to get a Provider Hosted sample working – with a AZURE website – and an Office 365 App.   This has been an “all day” thing – not working !

I’d done all the steps – with the ClientId – and ClientSecret – and included in my WEB.CONFIG.

But – when accessing my App, I’d simply see a message :

An error occurred while processing your request

This is coming from the following code – within the ‘default.aspx’ for the website.

protected void Page_PreInit(object sender, EventArgs e)
{
    Uri redirectUrl;
    switch (SharePointContextProvider.CheckRedirectionStatus(Context, out redirectUrl))
    {
        case RedirectionStatus.Ok:
            return;
        case RedirectionStatus.ShouldRedirect:
            Response.Redirect(redirectUrl.AbsoluteUri, endResponse: true);
            break;
        case RedirectionStatus.CanNotRedirect:
            Response.Write(“An error occurred while processing your request.“);
            Response.End();
            break;
    }
}

So – it was LOADING my site, but couldn’t display.

It turns out, that I’d been ‘faster-stepping’ through the wizard to assign the “CLIENT ID” and “CLIENT SECRET”.

If/when you’re using APPREGNEW.ASPX – make sure to put the correct Azure WebSite domain

As below – the APP DOMAIN is important – don’t just put ‘contoso’ or ‘localhost’.

image

It turns out, I’d been “super careful” on the CLIENT ID and CLIENT SECRET – but not paying much attention to the App-Domain.

Hope this helps – it woulda saved me a bunch-of-hours…!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s