我已经定制了sitecore内容项的发布过程,确保每当发布内容项本身时,都会发布/ sitecore / media library /目录中的相关媒体项。问题是,相关媒体项目可以很好地发布到Web数据库,但在发布到webcm数据库时会挂起。有什么理由吗?
这是我将内容项目的相关媒体项目发布到网络和webcm数据库的代码:
private void PublishItemAsynchronously(ref Item sourceItem, ref Item mediaItem, PublishItemContext context)
{
String databaseName = "webCM";
try
{
if (Sitecore.Configuration.Factory.GetDatabase(databaseName) != null)
{
PublishOptions options = new PublishOptions(mediaItem.Database, Factory.GetDatabase(databaseName),
PublishMode.Smart, mediaItem.Language, DateTime.Now);
options.RootItem = mediaItem;
options.Deep = false;
new Publisher(options).PublishAsync();
Sitecore.Diagnostics.Log.Info("___________ Inside PublishRelationsAction::PublishItemAsynchronously(...), just published from webCM ", this);
}
databaseName = "web";
PublishOptions options2 = new PublishOptions(mediaItem.Database, Factory.GetDatabase(databaseName),
PublishMode.Smart, mediaItem.Language, DateTime.Now);
options2.RootItem = mediaItem;
options2.Deep = false;
new Publisher(options2).PublishAsync();
Sitecore.Diagnostics.Log.Info("___________ Inside PublishRelationsAction::PublishItemAsynchronously(...), just published from web ", this);
}
catch (Exception ex)
{
....
}
}
任何想法为什么webcm数据库发布挂起,而所有发布到Web数据库的工作正常?上述两个日志记录都出现在我的日志文件中。
答案 0 :(得分:0)
禁用发布状态管理器可解决此问题。
您可以通过注释掉内容来禁用它
/App_Config/Include/Sitecore.SharedSource.AdvancedPublishDialog.config