Wildcard Inclusion Used to Create Personal Sites Does Not Exist

If you are leveraging Personal Sites in SharePoint 2013 you may run into an error with the non-interactive timer job used to create Personal Sites as a background task.  The timer job calls into the UserProfile Service application to create the Personal Site using the CreatePersonalSite() method, nothing special there.  However, in this method, the SharePoint will attempt to verify that the managed path for the Personal Sites URL exists, and if it does not exist, you will find a series of errors in your ULS log similar to the following:

Exception while creating personal site: (https://personalsites.contoso.com/personal/username/) for (CONTOSO\username):
(Microsoft.Office.Server.UserProfiles.PersonalSiteCreateConfigurationException:
A failure was encountered while attempting to create the site, wildcard inclusion used to create personal sites does not exist.     at
Microsoft.Office.Server.UserProfiles.UserProfile.<>c__DisplayClass2.<CreateSite>b__0()     at
Microsoft.SharePoint.SPSecurity.<>c__DisplayClass5.<RunWithElevatedPrivileges>b__3()     at
Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)     at
Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)     at
Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)     at
Microsoft.Office.Server.UserProfiles.UserProfile.CreateSite(String strRequestUrl, Boolean bCollision, Int32 overrideCompatLevel, Int32 lcid)     at
Microsoft.Office.Server.UserProfiles.UserProfile.CreatePersonalSiteWithSQM(String mySitePortalUrl, Int32 overrideCompatLevel, Int32 lcid)).

Exception during creation of personal site from MySiteInstantiationWorkItemJobDefinition::ProcessWorkItemCore() for i:0#.w|CONTOSO\username
Microsoft.Office.Server.UserProfiles.PersonalSiteCreateConfigurationException: A failure was encountered while attempting to create the site, wildcard inclusion used to create personal sites does not exist.      at
Microsoft.Office.Server.UserProfiles.UserProfile.<>c__DisplayClass2.<CreateSite>b__0()     at
Microsoft.SharePoint.SPSecurity.<>c__DisplayClass5.<RunWithElevatedPrivileges>b__3()     at
Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)     at
Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)     at
Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)     at
Microsoft.Office.Server.UserProfiles.UserProfile.CreateSite(String strRequestUrl, Boolean bCollision, Int32 overrideCompatLevel, Int32 lcid)     at
Microsoft.Office.Server.UserProfiles.UserProfile.CreatePersonalSiteWithSQM(String mySitePortalUrl, Int32 overrideCompatLevel, Int32 lcid)     at
Microsoft.Office.Server.UserProfiles.UserProfile.CreatePersonalSite(Int32 lcid)     at
Microsoft.Office.Server.UserProfiles.MySiteInstantiationWorkItemJobDefinition.ProcessWorkItemCore(SPWorkItemCollection workItems, SPWorkItem workItem, MySiteInstantiationWorkItemJobState timerJobState) StackTrace:  at
Microsoft.Office.Server.Native.dll: (sig=2e6bd61f-fab5-45d9-95e0-1298f4064064|2|microsoft.office.server.native.pdb, offset=131CE) at
Microsoft.Office.Server.Native.dll: (offset=21BFD)

MySiteInstantiationJob:ProcessWorkItem: ProcessWorkItemCore for My Site Instantiation for: 'i:0#.w|CONTOSO\username' failed.
Error Message: A failure was encountered while attempting to create the site, wildcard inclusion used to create personal sites does not exist.

Now, you may be scratching your head knowing that you have the personal site managed path created on the web application hosting the Personal Site site collections, so why can't it find the correct managed path.  Well, in fact the User Profile application is not looking at the list of managed paths on the web application, it’s looking at the list of managed paths defined on the SPContentService.  To find out what managed paths you have defined on your Content Service, you can run this bit of PowerShell from a SharePoint PowerShell console window:

 Get-SPManagedPath -HostHeader

This will likely output the following:

image

Notice you don’t see the "personal” Wildcard Inclusion managed path you are likely expecting to see, which is the cause of our failure.  To add the necessary managed path, execute the following PowerShell from a SharePoint console window:

New-SPManagedPath -RelativeURL "personal" -HostHeader

To verify the command added the managed path correctly, re-execute the following PowerShell from a SharePoint console window:

 Get-SPManagedPath –HostHeader

You should now see the new HH managed path, of type WildcardInclusion:

image