2

We are working in Sitecore 10.3 with SPS 7.0 We are trying to include new publishing target to Sitecore Publishing Service.

We are trying directly on XML files without using Patch to understand the changes so we can patch them later.

Lets say new Publishing Target is Preview.

We duplicated the web database and names as Preview.

We have completed in Sitecore for the new publishing target as per https://doc.sitecore.com/xp/en/developers/103/sitecore-experience-manager/create-a-publishing-target.html

In Sitecore Publishing Service we then added new connection string for Preview DB using

.\Sitecore.Framework.Publishing.Host configuration setconnectionstring Preview "server=xxx;Initial Catalog=Preview;Integrated Security=False;User ID=xxx;password=xxx;MultipleActiveResultSets=True"

In sc.publishing.web.command.service.xml, sc.publishing.schema.command.services.xml we added new Target Preview in Store Factory

<Preview>
                    <Type>Sitecore.Framework.Publishing.Data.TargetStore, Sitecore.Framework.Publishing.Data</Type>
                    <ConnectionNames>
                      <PreviewDatabase>Preview</PreviewDatabase>
                      <PreviewResources>PreviewResources</PreviewResources>
                    </ConnectionNames>
                    <FeaturesListName>TargetStoreFeatures</FeaturesListName>
                    <!-- The id of the target item definition in Sitecore. -->
                    <Id>19B15FB2-4112-4232-9ABB-5BFEE4EF0DAC</Id>
                    <!-- The name of the Database entity in Sitecore. -->
                    <ScDatabase>Preview</ScDatabase>
                  </Preview>

Default Connection Factory we added a new connection

<Preview>
                  <!-- Should match the name of the publishing target configured in SC. -->
                  <Type>Sitecore.Framework.Publishing.Data.AdoNet.SqlDatabaseConnection, Sitecore.Framework.Publishing.Data</Type>
                  <LifeTime>Transient</LifeTime>
                  <Options>
                    <ConnectionString>Preview</ConnectionString>
                    <DefaultCommandTimeout>120</DefaultCommandTimeout>
                    <Behaviours>
                      <backend>sql-backend-default</backend>
                      <api>sql-api-default</api>
                    </Behaviours>
                  </Options>
                </Preview>
                <PreviewResources>
                  <Type>Sitecore.Framework.Publishing.Data.ResourceItems.ResourceConnection, Sitecore.Framework.Publishing.Data.ResourceItems</Type>
                  <LifeTime>Transient</LifeTime>
                  <Options>
                    <Paths>
                      <Sitecore>items/sitecore/Preview</Sitecore>
                      <Modules>items/modules/Preview</Modules>
                    </Paths>
                  </Options>
                </PreviewResources>

We got the new Publishing Target in Schema List (“Hidden one is newly registered Db for Preview”)

enter image description here

New publishing target is registered

enter image description here

But we are getting in Sitecore as error enter image description here How to introduce new Publishing target in SPS ?

1
  • Error is not clear in the screenshot, add error as text. Commented Jun 8, 2023 at 3:35

2 Answers 2

0

We found this, it seems the Publishing service utilizes a folder C:\App_Data while publishing. This App_Data folder must be allowed for IIS users.

0

Here's a patch config for SPS 7.0 for reference. It adds a "Internet2" publishing target which uses a "web2" connection string.

You'll need to

  • Save this snippet to a xml file in the <publishingservice>\sitecoreruntime\production\config folder
  • Add a connection string for web2
  • Replace the guid with the ID of your publishing target /sitecore/system/Publishing targets/myPublishingTarget
  • Start publishing service and probably upgrade schema
<?xml version="1.0" encoding="UTF-8"?>
<!-- Config for Web2 / Interet2 Publishing Target -->
<Settings>
    <Commands>
        <Web>
            <Services>
                <Add>
                    <StoreFactory>
                        <Options>
                          <Stores>                          
                            <Targets>
                              <Internet2>
                                <Type>Sitecore.Framework.Publishing.Data.TargetStore, Sitecore.Framework.Publishing.Data</Type>
                                <ConnectionNames>
                                  <WebDatabase>Internet2</WebDatabase>
                                  <WebResources>Web2Resources</WebResources>
                                </ConnectionNames>
                                <FeaturesListName>TargetStoreFeatures</FeaturesListName>
                                <!-- The id of the target item definition in Sitecore. -->
                                <Id>8FC84F73-358A-41F9-97F1-0003F8570BE1</Id>
                                <!-- The name of the Database entity in Sitecore. -->
                                <ScDatabase>web2</ScDatabase>
                              </Internet2>
                            </Targets>
                          </Stores>
                        </Options>
                      </StoreFactory>
                      <DefaultConnectionFactory>                        
                        <Options>
                          <Connections>
                            <Internet2>
                              <!-- Should match the name of the publishing target configured in SC. -->
                              <Type>Sitecore.Framework.Publishing.Data.AdoNet.SqlDatabaseConnection, Sitecore.Framework.Publishing.Data</Type>
                              <LifeTime>Transient</LifeTime>
                              <Options>
                                <ConnectionString>Web2</ConnectionString>
                                <DefaultCommandTimeout>120</DefaultCommandTimeout>
                                <Behaviours>
                                  <backend>sql-backend-default</backend>
                                  <api>sql-api-default</api>
                                </Behaviours>
                              </Options>
                            </Internet2>
                            <Web2Resources>
                              <Type>Sitecore.Framework.Publishing.Data.ResourceItems.ResourceConnection, Sitecore.Framework.Publishing.Data.ResourceItems</Type>
                              <LifeTime>Transient</LifeTime>
                              <Options>
                                <Paths>
                                  <Sitecore>items/sitecore/web2</Sitecore>
                                  <Modules>items/modules/web2</Modules>
                                </Paths>
                              </Options>
                            </Web2Resources>
                          </Connections>
                        </Options>
                      </DefaultConnectionFactory>
                </Add>
            </Services>
        </Web>
        <Schema>
          <Services>
            <Add>
              <StoreFactory>
                <Options>
                  <Stores>
                    <Targets>
                      <Internet2>
                        <Type>Sitecore.Framework.Publishing.Data.TargetStore, Sitecore.Framework.Publishing.Data</Type>
                        <ConnectionNames>
                          <WebDatabase>Internet2</WebDatabase>
                          <WebResources>Web2Resources</WebResources>
                        </ConnectionNames>
                        <FeaturesListName>TargetStoreFeatures</FeaturesListName>
                        <!-- The id of the target item definition in Sitecore. -->
                        <Id>8FC84F73-358A-41F9-97F1-0003F8570BE1</Id>
                        <!-- The name of the Database entity in Sitecore. -->
                        <ScDatabase>web2</ScDatabase>
                      </Internet2>
                    </Targets>
                  </Stores>
                </Options>
              </StoreFactory>
              <DefaultConnectionFactory>
                <Options>
                  <Connections>
                    <Internet2>
                      <!-- Should match the name of the publishing target configured in SC. -->
                      <Type>Sitecore.Framework.Publishing.Data.AdoNet.SqlDatabaseConnection, Sitecore.Framework.Publishing.Data</Type>
                      <LifeTime>Transient</LifeTime>
                      <Options>
                        <ConnectionString>Web2</ConnectionString>
                        <DefaultCommandTimeout>120</DefaultCommandTimeout>
                        <Behaviours>
                          <backend>sql-backend-default</backend>
                          <api>sql-api-default</api>
                        </Behaviours>
                      </Options>
                    </Internet2>
                    <Web2Resources>
                      <Type>Sitecore.Framework.Publishing.Data.ResourceItems.ResourceConnection, Sitecore.Framework.Publishing.Data.ResourceItems</Type>
                      <LifeTime>Transient</LifeTime>
                      <Options>
                        <Paths>
                          <Sitecore>items/sitecore/web2</Sitecore>
                          <Modules>items/modules/web2</Modules>
                        </Paths>
                      </Options>
                    </Web2Resources>
                  </Connections>
                </Options>
              </DefaultConnectionFactory>
            </Add>
            </Services>
        </Schema>
        <ItemRevision>
          <Services>
            <Add>
              <StoreFactory>
                <Options>
                  <Stores>
                    <Targets>
                      <Internet2>
                        <Type>Sitecore.Framework.Publishing.Data.TargetStore, Sitecore.Framework.Publishing.Data</Type>
                        <ConnectionNames>
                          <WebDatabase>Internet2</WebDatabase>
                          <WebResources>WebResources</WebResources>
                        </ConnectionNames>
                        <FeaturesListName>TargetStoreFeatures</FeaturesListName>
                        <!-- The id of the target item definition in Sitecore. -->
                        <Id>8FC84F73-358A-41F9-97F1-0003F8570BE1</Id>
                        <!-- The name of the Database entity in Sitecore. -->
                        <ScDatabase>web2</ScDatabase>
                      </Internet2>
                    </Targets>
                  </Stores>
                </Options>
              </StoreFactory>
              <DefaultConnectionFactory>
                <Options>
                  <Connections>
                    <Internet2>
                      <!-- Should match the name of the publishing target configured in SC. -->
                      <Type>Sitecore.Framework.Publishing.Data.AdoNet.SqlDatabaseConnection, Sitecore.Framework.Publishing.Data</Type>
                      <LifeTime>Transient</LifeTime>
                      <Options>
                        <ConnectionString>Web2</ConnectionString>
                        <DefaultCommandTimeout>120</DefaultCommandTimeout>
                        <Behaviours>
                          <backend>sql-backend-default</backend>
                          <api>sql-api-default</api>
                        </Behaviours>
                      </Options>
                    </Internet2>
                    <Web2Resources>
                      <Type>Sitecore.Framework.Publishing.Data.ResourceItems.ResourceConnection, Sitecore.Framework.Publishing.Data.ResourceItems</Type>
                      <LifeTime>Transient</LifeTime>
                      <Options>
                        <Paths>
                          <Sitecore>items/sitecore/web2</Sitecore>
                          <Modules>items/modules/web2</Modules>
                        </Paths>
                      </Options>
                    </Web2Resources>
                  </Connections>
                </Options>
              </DefaultConnectionFactory>
                </Add>
            </Services>
        </ItemRevision>
    </Commands>
</Settings>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.