EPiServer 导入时出错:System.ArgumentException:不能与目的地相同

EPiServer Error during import: System.ArgumentException: Cannot be the same as destination

我正在尝试将内容从我们的 UAT 服务器导入到我们的生产服务器。

Production 数据库最初是从 UAT 数据库克隆而来的,两个代码库是相同的。

我在 exporting/importing 时的程序非常简单,首先:http://screencast.com/t/UkT1W7t7g

然后我从 UAT 获得包含所有内容的最终文件 (7MB+),然后我转到 Production 并 select 以下内容:http://screencast.com/t/UkT1W7t7g

单击导入时出现以下错误:http://screencast.com/t/lgr7jeFX

这是我在错误日志中得到的:

2016-11-28 10:31:04,995 [5] ERROR EPiServer.Core.Transfer.TransferLogger: 10.5.3 Export/import error: Exception: Cannot be the same as destination
Parameter name: contentLinkID
System.ArgumentException: Cannot be the same as destination
Parameter name: contentLinkID
at EPiServer.DataAccess.ContentSaveDB.Move(Int32 contentLinkID, Int32 destinationLinkID, Boolean archive)
at EPiServer.DataAbstraction.ContentStore.Move(Int32 contentLink, Int32 destinationLinkID, Boolean archive)
at EPiServer.DefaultContentProvider.Move(ContentReference contentReference, ContentReference destinationLink)
at EPiServer.Core.Transfer.ContentTransfer.MoveContent(IContent content, ContentReference parentLink, AccessLevel requiredDestinationAccess)
at EPiServer.Core.Transfer.ContentTransfer.Import(RawContent rawContent, AccessLevel requiredDestinationAccess, Guid& importedPageGuid)
at EPiServer.Core.Transfer.ContentTransfer.Import(ITransferContentData content, AccessLevel requiredDestinationAccess)
at EPiServer.Enterprise.DataImporter.ImportContents[T](XmlTextReader reader, ZipPackage package)
at EPiServer.Enterprise.DataImporter.ImportStream(ZipPackage package, XmlTextReader reader, String partName)
at EPiServer.Enterprise.DataImporter.ImportPartOfPackage(ZipPackage package, String partName)
at EPiServer.Enterprise.DataImporter.ImportRaw(ZipPackage package)
at EPiServer.Enterprise.DataImporter.Import()
System.ArgumentException: Cannot be the same as destination
Parameter name: contentLinkID
at EPiServer.DataAccess.ContentSaveDB.Move(Int32 contentLinkID, Int32 destinationLinkID, Boolean archive)
at EPiServer.DataAbstraction.ContentStore.Move(Int32 contentLink, Int32 destinationLinkID, Boolean archive)
at EPiServer.DefaultContentProvider.Move(ContentReference contentReference, ContentReference destinationLink)
at EPiServer.Core.Transfer.ContentTransfer.MoveContent(IContent content, ContentReference parentLink, AccessLevel requiredDestinationAccess)
at EPiServer.Core.Transfer.ContentTransfer.Import(RawContent rawContent, AccessLevel requiredDestinationAccess, Guid& importedPageGuid)
at EPiServer.Core.Transfer.ContentTransfer.Import(ITransferContentData content, AccessLevel requiredDestinationAccess)
at EPiServer.Enterprise.DataImporter.ImportContents[T](XmlTextReader reader, ZipPackage package)
at EPiServer.Enterprise.DataImporter.ImportStream(ZipPackage package, XmlTextReader reader, String partName)
at EPiServer.Enterprise.DataImporter.ImportPartOfPackage(ZipPackage package, String partName)
at EPiServer.Enterprise.DataImporter.ImportRaw(ZipPackage package)
at EPiServer.Enterprise.DataImporter.Import()

我不明白可能是什么问题,非常感谢任何帮助。

P.D.: 我已经在 EPiServer 开发论坛问过同样的问题 http://world.episerver.com/forum/developer-forum/-Episerver-75-CMS/Thread-Container/2016/11/error-during-import-system-argumentexception-cannot-be-the-same-as-destination

当 contentLinkID 等于 destinationLinkID 时出现该错误

反映的代码证实了这一点

public void Move(int contentLinkID, int destinationLinkID, bool archive)
{
    if (contentLinkID == destinationLinkID)
    {
        throw new ArgumentException("Cannot be the same as destination", "contentLinkID");
    }
// ...

检查您的 episerver 日志文件,它们会告诉您是哪个 contentLinkID 导致了错误。

最好的猜测是

  1. 应用程序池帐户对数据库或文件系统没有足够的权限
  2. 应用程序池无法写入或更新 app_data
  3. 中的文件

通常这是大多数人放弃的地方,而是使用数据库 backup/restore 迁移 Episerver。但是,如果您真的想彻底解决这个问题,我建议您自定义导入,请查看关于内容迁移的文章 Patrick van Kleef http://www.patrickvankleef.com/2015/08/18/episerver-content-migration/

Episerver 确实应该尽快解决这个问题!

觉得这是怎么回事?

您导出的包将在导入时下方您select的节点导入 - 不会覆盖select编辑的目标节点。

例如,您可以在 UAT 中的根页面下导出起始页,然后 select Root 作为生产中的目标。导入时,起始页将在 Root 页面 下方 结束。

在您的 UAT 环境中导出 Root 页面,然后尝试将该 导出到您的生产环境中的 Root 页面时发生错误.

本质上,您是在尝试将源根页面导入目标根页面下(因此内容 ID 与目标 ID 相同的例外情况)。

感谢 Ted。我做了以下并且有效:

在 UAT 中

导出开始:http://screencast.com/t/FgHRnOhuauR "Export files that the pages link to" 未选中。

导出结束:http://screencast.com/t/aPe0Ntvb9aq

10583 个内容项已导出到文件中。

然后在生产中

导入开始:http://screencast.com/t/qqkBsL731P 选中 "Update existing content items with matching ID"。

正在进行导入:http://screencast.com/t/reSfMnCV8

我注意到的一件事是,最后它说它只更新了一部分内容项,实际上我做了几次,因为 UAT 正在积极编辑并得到 28、16、1 的结果, 或 8 项导入(超过 10500 项)我想那是因为那些是唯一有变化或新项目的。

我确实检查了几个我知道已更新的块,它们在导入后与新版本匹配。

因为这是我完成的工作,所以我将 标记为已接受。

我认为在内容树中选择元素有点混乱,因为我想从根目录中获取所有内容并将其移动到另一台服务器上的根目录,但它似乎不是这样工作的。