SharePoint 2013: Host Named Site Collections and MySites

I needed to configure Host Named Site Collections for a few customers and ran into a few problems especially with the creation of MySites. I know that Host Named Site Collections (HNSC) were available in SharePoint 2010 and that Microsoft improved it in SharePoint 2013. Didn’t play with it in SharePoint 2010 and now with SharePoint 2013 I needed to configure it in order for customers to use the SharePoint app store.

Microsoft is recommending the HNSC as a preferred method as stated on TechNet: “Host-named site collections are the preferred method to deploy sites in SharePoint 2013“. However there are some things that doesn’t work out-of-the-box. As you may now the creation of HNSC can only be done by using PowerShell. There is no option within the GUI!

Host Named Site Collection creation

The creation as described on TechNet:

  1. Create a web application for host-named site collections

New-SPWebApplication -Name ‘Contoso Sites’ -port 80 -ApplicationPool ContosoAppPool -ApplicationPoolAccount (Get-SPManagedAccount ‘Contoso\JDoe’) -AuthenticationProvider (New-SPAuthenticationProvider –UseWindowsIntegratedAuthentication)

  1. Create a root site collection

New-SPSite http://<servername>&#8217; -Name ‘Portal’ -Description ‘Portal on root’ -OwnerAlias ‘contoso\administrator’ -language 1033 -Template ‘STS#0’

  1. Create host-named site collections

New-SPSite; -HostHeaderWebApplication http://<servername>&#8217; -Name ‘Portal’ -Description ‘Customer root’ -OwnerAlias ‘contoso\administrator’ -language 1033 -Template ‘STS#0’


It’s also possible to use managed paths with host-named site collections, first you have to create a managed path and then the host-named site collection:

New-SPManagedPath ‘departments’ –HostHeader

New-SPSite; -HostHeaderWebApplication http://<servername>&#8217; -Name ‘Marketing’ -Description ‘Portal Marketing’ -OwnerAlias ‘contoso\administrator’ -language 1033 -Template ‘STS#0’


Personal Site creation

On the TechNet page (see Resources), it’s not mentioned how you setup MySites with Host Named Site Collections. They only mention that it’s possible to have MySites as Host Named Site Collections and that the Self Service Site Creation does not work. So how do we configure MySites as Host Named Site Collections?

  1. Create a MySite database

New-SPContentDatabase WSS_Content_MySite -WebApplication http://<servername>&#8221;

  1. Create a host-named site collection

New-SPSite; -OwnerAlias ‘contoso\username’ -HostHeaderWebApplication http://<servername>&#8217; -Name “MySite Host” –Template “SPSMSITEHOST#0” -Language 1033 -ContentDatabase WSS_Content_MySite

  1. Create a managed Path

New-SPManagedPath “personal” –HostHeader


After running the commands you will be able to browse to the mysite Host, but creating your personal part of the mysite can’t be executed. This can be resolved by turning on Self Service Site Creation for the web application, make sure that this will be hidden for your users.

Next thing I needed to do was to create an additional Managed Path for the web application:

New-SPManagedPath “personal” -WebApplication “http://<servername&#8221;


This will actually lead to be able to create the personal part of the mysite. J

There is one catch however, you’re not be able to control in which content database the mysites will be created. There are two options to this problem, lock all databases except the mysite database(s) or use code. The first option, locking databases can be done, but is tricky. If you need to create an additional site collection in a locked database, you need to unlock that database in order to create the site collection. It is possible that there will be a mysite created that same time and stored in your unlocked database.

Give your favorite developer a cup of coffee and ask him to write some code that will handle the creation of the mysites. I’m not a developer, but I ran into a blog post from Wictor Wilen where Wictor provides the code for handling the creation of mysites into the correct mysite database(s). See Resources.



If you executed all the commands and mysite creation fails, check if there is something going on with the User Profile Service. In my case it turned out that the User Profile Import was in a stopping state. Also check if the FIM services are started.



Specifying Content Database for new Site Collections when using Host Named Site Collections

Host-named site collection architecture and deployment (SharePoint 2013)

One thought on “SharePoint 2013: Host Named Site Collections and MySites

  1. Hi.
    Thanks for your steps.
    But I can’t see that you have mention something about the My site settings in User Profile SA.
    Do you set the MySite host url to the web app URL?
    When i set the URL to MySite Host I’m getting follow error: The Web application
    at http://mysite.URL.local:80/ could not be found.
    If I set the URL to the web app url the personal site is not setting up with a proper URL.
    It means the URL is: http://webapp.url/personal/Username.
    What I would like is: http://mysite.URL.local/personal/Username.

    But maybe this is how it works with MySite host named site collection?

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.