You are usually adding new publishing targets in Sitecore because of different geographic regions or databases in different data centers where you are hosting these web databases.
For a long time, for Sitecore 7 and 8, process for creating new publishing target was more or less the same. You have created new entry in ConnectionStrings.config, added new entry in web.config and added new definition item in master database under “/sitecore/system/Publishing targets” node.
In Sitecore 9 process has been slightly changed. You are not changing web.config anymore but Sitecore.config and 2 additional steps are now involved for adding new publishing target. These two more steps are adding and elements in Sitecore.config.
In my example below, I will use “web_secondary” as name of publishing target database. I will use “QA” as name of publishing target.
Steps to add new publishing target in Sitecore 9:
- Create new target database in ConnectionStrings.config where you want content to be published:
- Add new entry in master database under “/sitecore/system/Publishing targets” node.
- Create a patch file under C:inetpubwwwrootinstancenameApp_ConfigIncludeProject or any other folder based on your setup. I have named my patch config file “PublishingTargets.config” and this is it’s content (you can just copy it and change web_secondary based on name of your secondary web database specified in ConnectionStrings.config):
Download the Publishing Target Patch File
- After applying these changes, you can see now pretty new publishing target in publishing dialog in Sitecore 9:
- Finally the newly added database must be created manually in SQL Server else Sitecore won’t start and will give you otherwise this nice exception:
Server Error in ‘/’ Application.
One or more exceptions occurred while processing the subscribers to the ‘property:changed’ event.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.AggregateException: One or more exceptions occurred while processing the subscribers to the ‘property:changed’ event.
[AggregateException: One or more exceptions occurred while processing the subscribers to the 'property:changed' event.] Sitecore.Events.EventSubscribers.RaiseEvent(String eventName, Object parameters, EventResult result) +1849 Sitecore.Events.Event.RaiseEvent(String eventName, Object parameters) +422 Sitecore.Data.Properties.PropertyStore.RaiseEvent(String name, Object parameters) +85 Sitecore.Web.Authentication.DefaultTicketManager.IsTicketExpired(Ticket ticket, Boolean useProlongation) +357 Sitecore.Web.Authentication.DefaultTicketManager.GetTicket(String ticketId, Boolean returnExpired) +118 Sitecore.Web.Authentication.DefaultTicketManager.IsTicketValid(String ticketId) +49 Sitecore.Shell.Web.ShellPage.IsLoggedIn(Boolean returnAfterLogin) +314 Sitecore.Shell.Web.UI.SecurePage.OnLoad(EventArgs e) +22 System.Web.UI.Control.LoadRecursive() +154 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4088
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2623.0