SharePoint 2013 Apps – 404 Error and Deployment Issue

404 Error

I went to deploy my first App to my test server, which has a host name of pamdev.com.  The app deployed correctly, so I made sure that the HOSTs entries were present and clicked on the app…and ran straight into a 404 Not Found.

Solution – Beware of host headers

If you are using a host header for your web application apps won’t just work for that web application. Because of how the redirect for the app domain works IIS will try to resolve the app url by using the default IIS web site, which of course doesn’t work. If you want to use host headers for your web applications you have to create an extra web application that is listening on port 80 (or 443 if you are using https) and that doesn’t have a host header.

This means that you have to create a web application like you normally would. You have to make sure that you select port 80 (or 443 if you are using https) and you should not fill in a host header. Note that you have to stop the Default Web Site in IIS in order to be able to do this. The web application will use the server name as its url. The web application can be empty except for a root site collection.

Another option is to use web applications without host headers and to create Host Header Site Collections. Be aware that Host Header Site Collections cannot be created via the user interface, they can only be created by using PowerShell.

Quote: http://sharepointchick.com/archive/2012/07/29/setting-up-your-app-domain-for-sharepoint-2013.aspx

Appendix

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.


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}

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

 

Deployment Issue

When I deployed my first App to my app site, it threw an error: Error occurred in deployment step ‘Install app for SharePoint’: We’re sorry, we weren’t able to complete the operation, please try again in a few minutes. If you see this message repeatedly, contact your administrator.

Solution

You cannot use your System Account (Farm Admin) to deploy the apps. After that, make sure your deployment account has admin permission to the Content Database of the apps Web Application and App Management Database.

Add-SPShellAdmin -database {id} -username {AccountName}

 

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