无法让核心服务客户端工作 [英] Unable to get Core Service client working
问题描述
我正在尝试使用核心服务发布组件,为此,我刚刚创建了一个控制台应用程序,并从服务器执行.我收到以下错误消息.
I am trying to publish the component using core service, to do this, I just created a console application, and executed from the server. I am getting the below error message.
未处理的异常:System.IO.FileNotFoundException:无法加载文件或程序集Tridion.ContentManager.CoreService.Client,版本=6.1.0.996,Culture=neutral,PublicKeyToken=ddfc895746e5ee6b"或其依赖项之一.系统找不到指定的文件.
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Tridion.ContentManager.CoreService.Client, Version=6.1.0.996, Culture=neutral, PublicKeyToken=ddfc895746e5ee6b' or one of its dependencies. The system cannot find the file specified.
下面是我的代码,有人遇到过这个问题吗?
The below is my code, can anyone faced this issue?
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();
}
}
推荐答案
看起来(根据您对 Igor 的回答的评论)您缺少一些配置.在 Tridion Practice 网站上查看 Frank 的 wiki 帖子 - https://code.google.com/p/tridion-practice/wiki/GetCoreServiceClientWithoutConfigFile
Looks like (based on your comment to Igor's answer) you're missing some config. Check out Frank's wiki post on the Tridion Practice site - https://code.google.com/p/tridion-practice/wiki/GetCoreServiceClientWithoutConfigFile
这篇关于无法让核心服务客户端工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!