Configuring SharePoint 2013 Host Named Site Collections and Apps Host

November 22 2012 105 comments

There are a few good articles about configuring Sharepoint 2013 apps host, but atleast I found it somehow difficult to figure out how for example Intranet web application and application host could be configured. For beginning you should read this article http://technet.microsoft.com/en-us/library/fp161230(v=office.15).aspx

The key to get apps host working is host named site collection (HNSC). Most of us have used host named web applications, but quite a few are familiar with host named site collections. Host named site collections are part of tenant technology and you can read more about it in Kirk Evans MSDN blog article http://blogs.msdn.com/b/kaevans/archive/2012/03/27/what-every-sharepoint-admin-needs-to-know-about-host-named-site-collections.aspx

I will first explain what we are going to do. The idea is to create web application that will host two site collections:
- Intranet site (http://intranet.sp.dev)
- Apps Catalog site (http://intranet.sp.dev/apps)

In SharePoint 2010 this wouldn’t have been possible since you couldn’t use managed paths with host named site collections. This is one of the improvements in 2013 and hence it’s now possible to use managed paths with HNSC.

Based on the technet article we are going to use url http://app-GUID.spapps.dev for apps. Note that this is not a subdomain of sp.dev –domain.
The first thing to do is to add DNS-records for intranet and apps. You can do this by following the steps listed in the following article http://technet.microsoft.com/en-us/library/fp161236.aspx. You should also start following services in Central Admin:
- App Management Service
- Microsoft SharePoint Foundation Subscription Settings Service

We are not going to take a look at these steps in more detail because there’s already tens of articles explaining how to do that.

Next we are going create a new host web application for site collections. This is done by PowerShell (note that managed account sp_app has to be added already):

$ap = New-SPAuthenticationProvider
$wa = New-SPWebApplication -DatabaseName "SharePoint_Content_Intranet" –ApplicationPool "Intranet" -Name "Intranet" -Port 80 -ApplicationPoolAccount (Get-SPManagedAccount "sp\sp_app") -AuthenticationProvider $ap

This will create an empty web application that will be using servers name as address. Next you have to create an empty site in CA to the web application root. I got a lot of critical events to the event log when it was missing. Also other users have reported issues if it’s missing (i.e. http://blogs.technet.com/b/mpriem/archive/2012/11/07/always-have-a-root-site-collection.aspx).

After that we will add intranet site collection. We will be using team site as site collection template (STS#0). You can get all templates by using Get-SPWebTemplate command.

New-SPSite "http://intranet.sp.dev" -OwnerAlias "SP\sp_install" -HostHeaderWebApplication $wa -Name "Intranet" –Template "STS#0"

Now you should be able to open address http://intanet.sp.dev. Let’s next create the apps host site for our intranet. We want to use URL http://intranet.sp.dev/apps thus we need to add a new managed path. SharePoint 2013 supports managed paths with host HNSC (SharePoint 2010 did also). A new managed path to be used with HNSC can be added by using PowerShell:

New-SPManagedPath -RelativeURL "apps" -HostHeader –Explicit

Let’s now add the App Catalog Site: APPCATALOG#0

New-SPSite "http://intranet.sp.dev/apps" -OwnerAlias “SP\sp_install" -HostHeaderWebApplication $wa -Name "Application Catalog" -Template “APPCATALOG#0”

After that we have to configure apps. This can be done in Central Admin Apps section. Click Manage App Catalog.

Apps section in CA

Select the right web application from top right corner and select Enter a URL for an existing app catalog site. Insert your app catalog address.

After that configure App URLs from Apps section.
Insert your app domain (spapps.dev) and app prefix (app).

You can now test your apps host by navigating to http://app-123456789.spapps.dev . You should get a login prompt.

Then comes the tricky question. What is the best practice for handling these URLs?
You cannot add http://*.spapps.dev to trusted sites or local intranet zone because it would compromise your security with certain browsers (), but I’m sure your users will be not happy with constant login prompts when they navigate to sites using apps. If you have an opinion about this, please leave a comment.

Note that if you want to crawl HNSCs you just add your web applications address to the search content source (not individual site collection addresses).

Popularity: 35% [?]

105 comments to “Configuring SharePoint 2013 Host Named Site Collections and Apps Host”

  1. Bryan says:

    The procedure entails taking down the tree and grinding away at the stump. Specialized tools like chippers, cranes, and chainsaws are needed, as well as skilled workers like the Christchurch Arborist team, join us!

  2. Fantastic post—thank you!

  3. Clarise says:

    Thank you for the information you shared here. Concrete company

  4. Ivan says:

    It’s good to see an interesting content. Thanks for sharing. junk removal near me

  5. Juliet says:

    Nice. I will take a look at this scenario after installing my wide fence. Thank you so much!

Leave a Reply