无法获取核心服务客户端的工作(Unable to get Core Service client w

2019-10-16 22:59发布

我试图使用发布核心服务组件,要做到这一点,我刚刚创建了一个控制台应用程序,并从服务器执行。 我收到以下错误消息。

未处理的异常:System.IO.FileNotFoundException:未能加载文件或程序集“Tridion.ContentManager.CoreService.Client,版本= 6.1.0.996文化=中性公钥= ddfc895746e5ee6b”或它的一个依赖。 该系统找不到指定的文件。

以下是我的代码,任何人都可以面对这个问题?

static void Main(string[] args)
{

    try
    {
        string compid = "tcm:56-935";

        var client = new SessionAwareCoreServiceClient();
        var readoption = new ReadOptions();
        var component = (ComponentData)client.Read(compid, readoption);
        var ItemToPublish = new List<string>();
        ItemToPublish.Add(component.Id);
        var instruction = new PublishInstructionData();
        var pubtarget = (PublicationTargetData)client.Read(
                                               "tcm:0-21-65537", readoption);
        List<string> target = new List<string>();
        target.Add(pubtarget.Id);
        client.Publish(ItemToPublish.ToArray(), instruction, target.ToArray(), 
                       PublishPriority.Normal, readoption);
        Console.WriteLine("component published");
        Console.WriteLine(component.Title);
        Console.WriteLine(pubtarget.Title);
        Console.ReadLine();

    }
    catch (Exception e)
    {
        Console.WriteLine(e.Message);
        Console.ReadLine();
    }
}

Answer 1:

看起来像(基于伊戈尔的回答您的评论)你错过了一些配置。 看看弗兰克的wiki后在外表套上实践网站- https://code.google.com/p/tridion-practice/wiki/GetCoreServiceClientWithoutConfigFile



Answer 2:

该错误是明显的,它说,你没有到位的依赖也。 你必须把Tridion.ContentManager.CoreService.Client.dll到同一目录下你的可执行文件是(或者,您也可以在GAC的地方)。 通常有在Visual Studio中对您的项目“复制本地”引用的程序集的选项,你可以尝试将其设置为true,并再次尝试执行代码。



文章来源: Unable to get Core Service client working