csharp 获得Tridion核心服务客户端

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp 获得Tridion核心服务客户端相关的知识,希望对你有一定的参考价值。

void Main()
{
        var client =
               getClient("SERVER", "USER", "PASSWORD", "DOMAIN");
        Console.WriteLine("Starting V" + client.GetApiVersion());

}

SessionAwareCoreServiceClient getClient(string hostName, string username,string password, string domain = null)
        {
            var httpBinding = new WSHttpBinding
                {
                    MaxReceivedMessageSize = 2147483647,
                    ReaderQuotas = new XmlDictionaryReaderQuotas
                        {
                            MaxStringContentLength = 2147483647,
                            MaxArrayLength = 2147483647
                        }
                };

        var remoteAddress =
               new EndpointAddress(
                       string.Format("http://{0}/webservices/CoreService2013.svc/wsHttp", hostName));

        var coreServiceClient = new SessionAwareCoreServiceClient(httpBinding, remoteAddress);

        if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password))
        {
               coreServiceClient.ClientCredentials.Windows.ClientCredential.UserName = username;
               coreServiceClient.ClientCredentials.Windows.ClientCredential.Password = password;
        }

        if (!string.IsNullOrEmpty(domain))
               coreServiceClient.ClientCredentials.Windows.ClientCredential.Domain = domain;

        return coreServiceClient;
}

以上是关于csharp 获得Tridion核心服务客户端的主要内容,如果未能解决你的问题,请参考以下文章

csharp 创建一个SDL Tridion用户trhough CoreService。假设将Tridion核心服务客户端DLL配置为app.config

如何在 Tridion 服务器上配置 Tridion 核心服务?

我应该如何决定 Tridion 核心服务绑定的配额?

powershell 列出Tridion站点核心服务系统用户

csharp 摆弄Tridion CD分类法......

csharp 摆弄Tridion CD分类法......