Wednesday 25 May 2022

Deactivate the Sitecore Publishing Service


Sitecore Publishing Service (SPS) is a great module designed by Sitecore. The SPS module Provides a lot of increase in the publishing performance. You may read my previous post on how to install Sitecore Publishing Service.

How to disable to Sitecore Publishing service and switch back to the default publishing process?

After the Sitecore Publishing Service (SPS) module has been installed, If you want to revert to the default publishing process then follow these steps.

  1. Locate the Sitecore.Publishing.Service.*.config files and change the file extension to .disabled. The files can be found in the following folders:

    1. Sitecore XP 9.X: the /App_Config/Modules/PublishingService folder.

  2. Switch to the Core database and rename the
    /Sitecore/system/Aliases/Applications/Publish item to PublishDisabled.


Once changes are done then you will be able to do the default publishing process. Now you can select any item or publish the site with the default publishing process.


Note: To active the Sitecore Publishing Service module, revert the changes that you have made.

Reference: Revert to default publishing after installing the Sitecore Publishing Service module


  1. how to install Sitecore Publishing Service.
  2. While installing Sitecore Publishing Service, Get the error about "DotNet Core Library".




Sunday 22 May 2022

Sitecore Publishing Service 4.3.0 Setup Error With DotNet Core Library

Recently I was trying to set Sitecore Publishing Service 4.3.0 with Sitecore 9.3.

While trying to set up the Publishing Service manually, and did all the steps described in the documentation. After those, I tried to visit the site using the following URL to verify the solution.

http://sitecorepublishing/api/publishing/operations/status



Application startup exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileLoadException: Could not load file or assembly 'Serilog.AspNetCore, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.

   --- End of inner exception stack trace ---

   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)

   at Serilog.Settings.Configuration.ConfigurationReader.LoadConfigurationAssemblies()

   at Serilog.Settings.Configuration.ConfigurationReader..ctor(IConfigurationSection configuration, DependencyContext dependencyContext)

   --- End of inner exception stack trace ---

   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)

   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)

   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)

   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)

   at Sitecore.Framework.Publishing.Host.SerilogExtensions.SerilogConfigurationSection(LoggerSettingsConfiguration settingConfiguration, IConfigurationSection configuration, DependencyContext dependencyContext)

   at Sitecore.Framework.Publishing.Host.Startup.ConfigureLogging(ILoggingBuilder loggingBuilder)

   at Microsoft.Extensions.DependencyInjection.LoggingServiceCollectionExtensions.AddLogging(IServiceCollection services, Action`1 configure)

   at Sitecore.Framework.Publishing.Host.Startup.ConfigureServices(IServiceCollection services)

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)

   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()

   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

Press Ctrl+C to shut down.


The error was complaining about "Serilog.AspNetCore.dll" which comes with the Publishing service installation.

Solution: I open the properties of  "Serilog.AspNetCore.dll"  and click the "Unlock" button in the popup window.


Then, Sitecore Publishing Service start to work as expected.



How to install Sitecore Publishing Service - Quick Guide.









Sitecore Publishing Service - Quick Guide

Sitecore Publishing Service

The Sitecore Publishing Service (SPS) module integrates with the opt-in Publishing Service, supporting high-performance publishing in large-scale Sitecore setups. The Publishing Service module is an optional replacement for the existing Sitecore publishing methods. This module increases publishing throughput, reduces the amount of time spent publishing large volumes of items, and offers greater data consistency and reliability. The module also improves the user experience and provides better visual feedback to the user on the state of the publishing system.


Publishing Module

The Sitecore Publishing Module is distributed as a standard Sitecore package.

Installation Guide.

Check Compatibility Table for SPS: Sitecore Publishing Service – compatibility tables

I am installing Sitecore Publishing Service 4.3.0 for Sitecore 9.3 version.

Download these two zip files.

  1. Sitecore Publishing Service: Sitecore Publishing Service
  2. Sitecore Publishing Service Module: Sitecore Publishing Service Module
The SPS module comes in 2 parts. The hosting service and the Sitecore package.

Manual Installation

  1. Extract the Sitecore Publishing Service to a folder of your choice. For example: C:\inetpub\wwwroot\sitecorepublishing
  2. In IIS, create a new site pointing to the folder 
  3. Start the IIS Manager and in the Connections panel, expand Sites. Right-click Sites and then click Add Website.
  4. In the Add Website dialog, fill in the required fields


  5. In the IIS Manager, right-click the application pool for the website that you created, and then click Basic Settings.
  6. In the Edit Application Pool dialog, in the .NET CLR version field, select No Managed 
    Code.

    Add in your host file the domain along with the respective IP address as follows:

    127.0.0.1   sitecorepublishing

You need to update the connection strings of the Sitecore Instance you want to use. For example, I have a Sitecore instance name sc931. So, I go to the website/App_Config folder and edit the ConnectionStrings.config by adding the attribute ‘MultipleActiveResultSets=True’ to the Core, Master, and Web databases.

Core

connectionString=”user id={userId};password={Password};Data Source={Datasource};Database=sc931_Core;MultipleActiveResultSets=True;“

Master

connectionString=”user id={userId};password={Password};Data Source={Datasource};Database=sc931_Master;MultipleActiveResultSets=True;“

Web

connectionString=”user id={userId};password={Password};Data Source={Datasource};Database=sc931_Web;MultipleActiveResultSets=True;“


Once this is completed, we need to make the Host Service access the database of the Sitecore Instance. Go to path C:\inetpub\wwwroot\sitecorepublishing\config\global and create a file name sc.connectionstring.xml and paste the following connections in it. 


The above connection string will allow the Host service to get access to the databases of the Sitecore Instance. When upgrading the database schema. Please see the following steps for the creation and up-gradation of the databases:

  1. Open the Command Prompt with Admin rights.
  2. Navigate to the directory of the publishing host service.Example: cd  C:\inetpub\wwwroot\sitecorepublishing
  3. Run the command
    Sitecore.Framework.Publishing.Host.exe schema list
    Sitecore.Framework.Publishing.Host.exe schema upgrade --force
To see if the Host Service has been installed and configured correctly, go to the following URL http://{site url}/api/publishing/operations/status and we need to have a response of {“status”:0}. If you receive any other value, check the application logs for further details. All logs files are here C:\inetpub\wwwroot\sitecorepublishing\logs.

Note: If you are not able to see any logs file then go to web.config file and change the value of "stdoutLogEnabled" to "True".
<aspNetCore processPath=".\Sitecore.Framework.Publishing.Host.exe" arguments="" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />


The configuration of the Host Service has been completed. Now Install the Sitecore Publishing Service module on your Sitecore Instance. Once this is installed, from the Launchpad you will see the Publishing Icon. But before clicking on the Publishing Icon, you need to specify the link between the Host Service and the Publishing Module. To do so, create a new configuration file and name it z.PublishingService.config. In the config file, paste the setting for the link as shown below:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
    <sitecore>
        <settings>
            <setting name="PublishingService.UrlRoot" value="http://sitecorepublishing/"></setting>
            </settings>
        </sitecore>
</configuration>

Place the configuration file to the path ‘Website/App_Config/Include/‘. Reload your Sitecore Instance and click on the publishing icon to navigate to the Publishing Dashboard.


This is the Publishing Dashboard, where you see the Active, Queued, and Recent Jobs.







Sitecore Publishing Service 7.0 Installation Guide

  About the Publishing Service module The Publishing Service module is an optional replacement for the existing Sitecore publishing methods....