【问题标题】:Unable to delete component via TridionCoreService无法删除 Tridion 核心服务中的组件
【发布时间】:2012-11-09 13:10:41
【问题描述】:

我无法使用 CoreService SessionAwareCoreServiceClient 删除任何项目。我能够创建/读取组件,创建文件夹......作为一个错误,我得到“对象引用未设置为对象的实例”。我想指出,我在 Tridion Content Manager 机器之外的应用程序中使用了核心服务。以下是来自 CM 服务器的日志:

用户:NT AUTHORITY\NETWORK SERVICE

StackTrace 信息详细信息:在 Tridion.UGC.EventHandler.UGCEventHandler.GetDataSourcesForTCM(String[] 中医)在 Tridion.UGC.EventHandler.UGCEventHandler.DeleteItemStats(TcmUri tcm)
在 Tridion.UGC.EventHandler.UGCEventHandler.HandlerForComitted(IdentifiableObject 主题,DeleteEventArgs 参数,EventPhases 阶段)在 System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo 方法、对象目标、Object[] 参数、SignatureStruct& sig、 MethodAttributes methodAttributes, RuntimeType typeOwner) 在 System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo 方法, 对象目标、Object[] 参数、签名 sig、MethodAttributes 方法属性,RuntimeType typeOwner) 在 System.Reflection.RuntimeMethodInfo.Invoke(对象 obj,BindingFlags invokeAttr、Binder binder、Object[] 参数、CultureInfo 文化、 Boolean skipVisibilityChecks)在 System.Delegate.DynamicInvokeImpl(Object[] args) 在 Tridion.ContentManager.Extensibility.EventSubscription.DeliverEvent(IEnumerable1 subjects, TcmEventArgs eventArgs, EventPhases phase) at Tridion.ContentManager.Extensibility.EventSystem.DeliverEvent(IEnumerable1 主题, TcmEventArgs eventArgs, EventDeliveryPhase deliveryPhase)
在 Tridion.ContentManager.Extensibility.EventSystem.DeliverEvent(IdentifiableObject 主题, TcmEventArgs eventArgs, EventDeliveryPhase deliveryPhase)
在 Tridion.ContentManager.IdentifiableObject.Delete(DeleteEventArgs deleteEventArgs) 在 Tridion.ContentManager.IdentifiableObject.Delete() 在 Tridion.ContentManager.CoreService.CoreServiceBase.Delete(String id)
在 SyncInvokeDelete(Object , Object[] , Object[] ) 在 System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(对象 实例,Object[] 输入,Object[]& 输出)在 Tridion.ContentManager.CoreService.TransactionSupportInvoker.Invoke(对象 实例,Object[] 输入,Object[]& 输出)在 System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& RPC)在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& RPC)在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& RPC)在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& RPC)在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& RPC)在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& RPC)在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& RPC)在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& RPC)在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) 在 System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

使用已使用的帐户,我可以手动删除项目,这意味着我拥有正确的权限。任何有关的帮助/建议都将不仅仅是可用的......


 _client = new SessionAwareCoreServiceClient("wsHttp_2011");
            bool useWindowsCredentials = bool.Parse(Environment.EnvironmentUserSettings.UseWindowsCredentials);
            var credentials = CredentialCache.DefaultNetworkCredentials;
            if (!useWindowsCredentials)
            {
                string password=Environment.EnvironmentUserSettings.Password;
                credentials = new NetworkCredential(Environment.EnvironmentUserSettings.UserName, password);
            }

            _client.ChannelFactory.Credentials.Windows.ClientCredential = credentials;

此代码用于模拟。在设置文件中,我可以选择是否使用 Windows 凭据或设置文件中的凭据。我使用 Windows LDAP 帐户或手动输入凭据时遇到错误。我还没有尝试为此使用 SDL Administrator。我会尝试并通知你。无论如何,谢谢你的努力

@更新: 我已经尝试使用具有基本 http 端点的常规 CoreService 并且仍然得到相同的错误。因此,身份验证不会在这里造成问题。 UGC 事件似乎出了点问题。不幸的是,我没有代码源,也没有关于启用 UGC 的 dll 的任何其他信息。

【问题讨论】:

  • 您正在使用哪个核心服务客户端,会话感知客户端或“正常”,以及您使用什么用户帐户执行此操作(是标准用户、服务用户还是 SDL Tridion 管理员)?
  • 我正在使用 SessionAwareClient。它是具有正确权限的标准用户帐户
  • 您是否为删除事件启用了事件系统?尝试通过核心服务删除某些内容时,我很惊讶地看到事件系统错误......
  • 否,Delete 事件未启用事件触发器。事件也应该在手动删除按预期工作的情况下触发......奇怪的外表:)

标签: tridion tridion-2011


【解决方案1】:

堆栈跟踪提到了 UGCEventHandler,所以我假设 UGC 已安装,您可以尝试暂时禁用此事件系统,看看是否有帮助,但我认为这不是问题的根源,因为您提到您能够与该用户一起手动删除。

但是,您提到“...在 Tridion Content Manager 机器之外的应用程序中使用核心服务”,并且您正在使用会话感知核心服务。

编辑:所以您使用的是会话感知核心服务客户端,并且您也提供了密码。这并没有真正加起来,会话感知核心服务客户端应该用于您的用户帐户已经过身份验证的情况,或者当您通过有效的 SDL Tridion Impersonation 用户调用核心服务时,您可以模拟核心服务仅通过用户名调用有效的 SDL Tridion 用户名(无需密码)。

尝试使用此处所述的常规核心服务客户端:Get Core Service Client without config file

或者,如果您坚持使用 Session Aware Core Service Client(我认为您的情况是错误的),请确保您的应用程序在有效的 SDL Tridion Impersonation 用户下运行(因为您在需要的外部服务器上运行在 SDL Tridion MMC 管理单元中为其添加域帐户),然后像这样模拟核心服务客户端:

using (SessionAwareCoreServiceClient client = new SessionAwareCoreServiceClient())
{
    // impersonate with valid user
    client.Impersonate("SDL Tridion Username here");
    // use client
    client.Delete(...);
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-10-05
    • 1970-01-01
    • 2012-04-21
    • 1970-01-01
    • 2012-09-11
    • 1970-01-01
    • 2013-01-07
    • 2012-12-22
    相关资源
    最近更新 更多