Auto-staging tasks executing on multiple target servers when only one staging server enabled

Kentico Licenses asked on January 10, 2022 21:30

We followed this code for configuring auto-staging on a Kentico 12 MVC site. There is only one configured and enabled target Staging Server, while there are ~25 sites on this Kentico instance.

When I make a change to a page of content, there is one staging task generated, and this is executed once (makes sense, since there is one staging server configured). When I change a user who is assigned to a single site, there is one staging task created, however, this task is executed 25 times. When I add debugging code, the code that iterates through the target servers (see code in link above), executes for each configured site in this Kentico instance (25 sites).

The following code retrieves the multiple servers associated with the task:

var taskServerIds = SynchronizationInfoProvider.GetSynchronizations()                                                                            
                   .WhereEquals("SynchronizationTaskID", e.Task.TaskID);

I would have assumed only 1 site would be associated with the change to the user. Why are all the sites in this instance associated with this task which only seems to be related to one site? Our custom code that utilizes the Kentico API to make content changes is also reacting the same way, executing 25 times per task.

We are troubleshooting content staging issues and I'm just trying to exclude this multiple target servers as a factor.

Thank you.

Recent Answers

Dmitry Bastron answered on January 11, 2022 05:45


If I'm not mistaken this is the default behaviour. Users (as well as roles, page types, etc.) are global objects that can be assigned to one or multiple sites. Therefore user-site assignment (UserSiteInfo) is what likely triggers these extra tasks for each of the sites. Please have a read of this documentation article, I hope it will shed some light on your subject.

1 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on January 11, 2022 07:19

Just to add to what Dmitry said, I would try using also these web.config keys to see if it makes any difference:
* CMSStagingTreatServerNamesAsInstances and/or
* CMSStagingLogGlobalObjectsOnlyForAssignedSites

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.