Question

I created a simple hello world sharepoint hosted app based on the template in Visual Studio 2012. I added nothing. When I hit F5 it works but when I publish and add it to my App Catalog and try to add it to Site, it first asked whether trust it, (I hit "trust it") and then I shows "The page can't be displayed, make sure web address is correct, blah blah ". What is different when you hit F5 and when you publish a SP app? When you hit F5 the url begins with

   http://app-9393939394.myappdomain/.... 

but when you publish it the url looks like

   http://mySPsite/_layouts/15/.....

thanks for your advice, I appreciate it.

Was it helpful?

Solution

In terms of where and how your app is ultimately deployed, there is actually no difference between pressing F5 in Visual Studio and installing the app from the App Catalog.

When you press F5 in your Visual Studio App for SharePoint project, Visual Studio will open your browser to one of the following URLs:

 http://[host web URL]/_layouts/15/viewlsts.aspx  (no app permissions requested)
 http://[host web URL]/_layouts/15/appInv.aspx... (app permissions requested)

This will show your app in the Site Contents list (you can also access this link from the quick launch or Site Actions menu on your SharePoint site). This is also the URL where you will be taken after you add an app from the App Catalog. If you try to click the link for your app, however, you will see the URL is in this format:

 http://[host web URL]/_layouts/15/appredirect.aspx?instance_id={GUID}

With apps for SharePoint, there are two SPWebs involved: the host web and the app web. The host web is the SPWeb where the user installs the app, and the app web is the SPWeb that contains an app instance's isolated storage (for any internal resources the app may provision such as lists, HTML/CSS/JS assets, etc.) For security reasons, your app web should be located on a separate app domain that is different from the domain where SharePoint is installed.

The appredirect.aspx page, as the name suggests, will redirect you to the Start Page you specify in your app's AppManifest.xml file, which is in the format:

 http://[app prefix][app hash].[app domain]/[relative site URL]/[app name]/Pages/Default.aspx

If you are getting a 404 error when trying to acceess the app's start page, it is because you have to do some IT pro work to configure the app domain so that everyone can access pages in the app domain. This involves setting up the app domain in DNS and creating a forward lookup zone and a CNAME alias (because each app web's URL will contain a unique hash). These steps are described in detail in this TechNet article.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top