Commerce Server Staging

If you are having issues setting up Commerce Server Staging, I have some tips here to get started. The documentation from Sitecore is not quite clear on what it is and how to use it. This post is not a guide on how to configure CSS as the literature already covers this procedure.

What is Commerce Server Staging (CSS)?

The MSDN documentation on this topic is about 10 years out of date, so let's give a more up to date definition. As we don't typically build Commerce Server Sites using all the bits and pieces, the "Web sites" part doesn't apply anymore.

The role of the CSS service in Sitecore Commerce (as I understand) is to copy business data from one Commerce Server site to another. As noted in the MSDN documentation, several network topologies are supported. For this article I'm just going to cover the most basic type of replication, which is same-server from one site to another.

The scenario

In my Commerce Server instance I have got two Commerce Server sites.

  1. An authoring environment where products are created and enriched
  2. A publishing environment where transactions occur.
These two sites link to Sitecore Content Management (CM) and Content Delivery (CD) respectively. Note that it is not necessary to have more than one Commerce Site in your solution, but this post focuses on how we can use Commerce Server Staging to "publish" our data. If you have set up CSS correctly and Sitecore is configured to use it, you will see the following dialog box when you publish:


The dialog box shows all configured Commerce Server Staging projects in your system.

Pitfalls

There are a few issues that can stop CSS replication from working properly. They are documented here below.

Incorrect service user

The Commerce Server installer application is supposed to allow you to set the service user that the service will run under. In most installations, this needs to be the "xxxRunTimeUser" that you create to run all the Commerce Server components and IIS AppPools under. In some cases the Commerce Server Configuration wizard will quit during this process and fail to perform the action to do this.

The implication of the CSS service not running under your run time user is that it quite possibly may not work. Sitecore may not even be able to talk to the CSS DCOM component to kick off the staging project. When you try to start the staging project, you might get a number of unexplained errors that look similar to the following:


To resolve this issue, you need to change the service user of the CSS Service. To do this, follow this procedure:
  1. Open services.msc. Search for the Commerce Server Staging Service.
  2. Open the properties and go to the Log On page. Set the service account to be the RunTimeUser that you created when installing Commerce Server.
  3. Restart the service and try to run the staging project again. Check that the entities you selected are copied to your target CS Site.

Sitecore can't talk to the CSS Service

When you publish in Sitecore, you might get a message similar to the following:

Error: An unexpected error was encountered while connecting to the Commerce Server staging system. See the sitecore log file for more information.

This can happen for a variety of reasons, but they all stem from the fact that Sitecore has incorrect permissions. Check the following is true:
  • The IIS AppPool user is set to be the RunTimeUser that you created when installing Commerce Server.
  • The RunTimeUser has appropriate permissions to use the CSS DCOM component.
  • You have defined a staging project in Commerce Server Staging Manager.
  • The Commerce Server Staging service is running.
Note that I experienced the issue where the service crashed every time Sitecore tried to communicate with it. The root cause was found to be that the service user was not the same as the IIS AppPool user. This is really important!

Comments