5

我正在为 Tridion 2009 SP 1 编写一个自定义页面,该页面基于查询字符串发布一个页面,该查询字符串将从计划任务中调用。

我正在使用以下代码:

string pageId = Request.QueryString["page_id"];
string targetId = Request.QueryString["publication_target_id"];

if (string.IsNullOrEmpty(pageId))
{
    Response.Write("This page is intended to be called automatically with a " +
                 + "page id and publication target id");
    return;
}

TDSE tdse = new TDSE();
string publicationId = pageId.Split('-')[0].Substring(4);
var publication = tdse.GetPublication("tcm:0-" + publicationId + "-1");
var page = tdse.GetPage(pageId, publication);
var target = tdse.GetPublicationTarget(targetId);
page.Publish(target, true, false, true);

Response.Write("Successfully published " + page.Title + " to " + target.Title);

这似乎有效,我可以看到队列中的页面,但它们仍处于“进行中”状态。

我仍然可以毫无问题地手动发布页面。

部署程序日志显示它没有收到工作,但是我可以看到 c:\tridion\work 文件夹中的项目(我使用的是本地文件系统 pub 目标)。

有任何想法吗?

更新:这是发布者像 TcmPublisher /debug 一样运行时的发布日志

01/06/2012 14:34:17 <5440> [Publisher]              Queue message [769571] is retrieved from Queue consumer handler for PublishQueue
01/06/2012 14:34:17 <4896> [Publisher]              Queue message handler for PublishQueue [0] working on queue message 769571
01/06/2012 14:34:17 <4896> [DefaultPublishTransactionHandler]   Handling publish transaction [tcm:0-93950-66560]
01/06/2012 14:34:17 <4896> [DefaultPublishTransactionHandler]   Publishing item [tcm:32-206093-64] from publication [tcm:0-32-1] to target [tcm:0-1-65537]
01/06/2012 14:34:17 <4896> [Transporting]           Storage location: c:\tridion\incoming\tcm_0-93950-66560.Content\
01/06/2012 14:34:17 <4896> [Resolve engine]             Getting resolver(s) for item type Tridion.ContentManager.CommunicationManagement.Page
01/06/2012 14:34:17 <4896> [Resolve engine]             Using resolver [Tridion.ContentManager.Publishing.Legacy.Resolving.PageResolver]
01/06/2012 14:34:17 <4896> [Legacy resolving]           Resolving the page [tcm:32-206093-64] took 00:00:00.0136441
01/06/2012 14:34:17 <4896> [Legacy resolving]           Resolved page [tcm:32-206093-64] with title 'Website Redirects'
01/06/2012 14:34:17 <4896> [DefaultPublishTransactionHandler]   Resolving took: 00:00:00.0468768
01/06/2012 14:34:17 <4896> [Render engine]              Getting renderer(s) for item type Tridion.ContentManager.CommunicationManagement.Page and template type CompoundTemplate
01/06/2012 14:34:17 <4896> [Render engine]              Using renderer [Tridion.ContentManager.Templating.TemplatingRenderer]
01/06/2012 14:34:17 <4896> [Render engine]              Getting renderer(s) for item type Tridion.ContentManager.ContentManagement.Component and template type CompoundTemplate
01/06/2012 14:34:17 <4896> [Render engine]              Using renderer [Tridion.ContentManager.Templating.TemplatingRenderer]
01/06/2012 14:34:17 <4896> [Render engine]              Rendering took: 00:00:00.2469570
01/06/2012 14:34:17 <4896> [Render engine]              Emmbed the result of this rendered component presentation with a tcdl:ComponentPresentation link for component [tcm:32-206079] with template [tcm:32-206080-32]
01/06/2012 14:34:17 <4896> [Render engine]              Rendering took: 00:00:00.3473678
01/06/2012 14:34:17 <4896> [Transporting]           Adding rendered item to the transport package: item [tcm:32-206093-64] 'Website Redirects' with template [tcm:32-206092-128] 'z_Htaccess Template'
01/06/2012 14:34:17 <4896> [Transporting]           Using transport package handler: Tridion.ContentManager.Publishing.Transporting.DefaultPageHandler
01/06/2012 14:34:17 <4896> [Transporting]           Adding Page tcm:32-206093-64 to the transport package for publishing
01/06/2012 14:34:17 <4896> [Transporting]           Writing file: c:\tridion\incoming\tcm_0-93950-66560.Content\Pages\site\us\redirects.htaccess
01/06/2012 14:34:18 <4896> [Transporting]           Adding rendered item to the transport package: item [tcm:32-206079] 'Redirects' with template [tcm:32-206080-32] 'HtAccess Url Redirects'
01/06/2012 14:34:18 <4896> [Transporting]           Using transport package handler: Tridion.ContentManager.Publishing.Transporting.DefaultComponentHandler
01/06/2012 14:34:18 <4896> [Transporting]           Add component [tcm:32-206079] with template [tcm:32-206080-32] to the transport package for publishing
01/06/2012 14:34:18 <4896> [Transporting]           Add schema [tcm:32-190-8] to the transport package for publishing
01/06/2012 14:34:18 <4896> [Transporting]           Building path for No (tcm:3-64-1024)
01/06/2012 14:34:18 <4896> [Transporting]           Building path for Yes (tcm:3-63-1024)
01/06/2012 14:34:18 <4896> [Transporting]           Add binary [tcm:0-0-0] with filename '.htaccess' and path '\site\us\.htaccess' to the transport package for publishing
01/06/2012 14:34:18 <4896> [DefaultPublishTransactionHandler]   Updating the publish transaction with the list of processed items
01/06/2012 14:34:18 <4896> [Transporting]           Saving the transport package
01/06/2012 14:34:18 <4896> Sending deploy control [Commit] for transaction [tcm:0-93950-66560] to deployer.
01/06/2012 14:34:18 <4896> [DefaultPublishTransactionHandler]   Publish transaction took 00:00:00.6889970
01/06/2012 14:34:18 <4896> [Publisher]              Cache statistics: SimpleCache: 14 Regions, 17 Objects, 20 Hits, 17 Misses
01/06/2012 14:34:18 <4896>  Region 'Component': 1 Objects, 6 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'PublishTransaction': 1 Objects, 1 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'PublicationTarget': 1 Objects, 0 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'Page': 1 Objects, 3 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'Publication': 1 Objects, 0 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'Tdse': 1 Objects, 0 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'User': 1 Objects, 0 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'PageTemplate': 1 Objects, 2 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'TemplateBuildingBlock': 3 Objects, 5 Hits, 3 Misses.
01/06/2012 14:34:18 <4896>  Region 'ComponentTemplate': 1 Objects, 2 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'StructureGroup': 1 Objects, 0 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'Schema': 1 Objects, 0 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'Keyword': 2 Objects, 0 Hits, 2 Misses.
01/06/2012 14:34:18 <4896>  Region 'Category': 1 Objects, 1 Hits, 1 Misses.
01/06/2012 14:34:18 <5440> [Publisher]              Deleting queue message: 769571 from Queue consumer handler for PublishQueue
4

3 回答 3

4

这很奇怪,我不明白会有什么不同。

您是否尝试过启用发布者日志?或者更好的是,在调试模式下运行发布者 (tcmpublisher /debug) 并尝试找出发生了什么。由于它卡在“进行中”,因此出版商可能对此负责。

于 2012-06-01T13:42:34.973 回答
2

我的直接怀疑是您在 CM 方面正在做一些不同的事情。否则很难解释手动发布的成功。

您说您可以手动发布页面而不会出现问题。您能否确认它适用于通过自定义页面失败的相同页面?

当然,下一个问题是出版目标是否相同。手动发布时,当然要选择目标类型,但使用 API 时,可以选择目标类型或发布目标。文本说您应该使用发布目标。你是?与您手动使用的目标类型关联的发布目标是否相同?(当然,当它到达部署者日志时,只有一个发布目标。)

您已指定 ActivateBlueprinting 和 RollbackOnFailure。这些设置是否反映了您在手动测试中所做的事情?(那么出版物 32 是您出版的那个还是一个孩子?)

于 2012-06-02T17:47:38.950 回答
1

“我可以看到 c:\tridion\work 文件夹中的项目” - 你看到解压缩的传输包还是其他东西?

你有 Deployer 登录 DEBUG 吗?

于 2012-06-01T13:51:40.220 回答