Reputation: 678
I am unable to delete any item using CoreService SessionAwareCoreServiceClient. I am able to create/read components, create folders... . As an error I have got "Object reference not set to an instance of an object". I would like to note that I am using core service in my application outside Tridion Content Manager machine. Here are logs from the CM server:
User: NT AUTHORITY\NETWORK SERVICE
StackTrace Information Details: at Tridion.UGC.EventHandler.UGCEventHandler.GetDataSourcesForTCM(String[] tcm) at Tridion.UGC.EventHandler.UGCEventHandler.DeleteItemStats(TcmUri tcm)
at Tridion.UGC.EventHandler.UGCEventHandler.HandlerForComitted(IdentifiableObject subject, DeleteEventArgs args, EventPhases phase) at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Delegate.DynamicInvokeImpl(Object[] args) at Tridion.ContentManager.Extensibility.EventSubscription.DeliverEvent(IEnumerable1 subjects, TcmEventArgs eventArgs, EventPhases phase) at Tridion.ContentManager.Extensibility.EventSystem.DeliverEvent(IEnumerable
1 subjects, TcmEventArgs eventArgs, EventDeliveryPhase deliveryPhase)
at Tridion.ContentManager.Extensibility.EventSystem.DeliverEvent(IdentifiableObject subject, TcmEventArgs eventArgs, EventDeliveryPhase deliveryPhase)
at Tridion.ContentManager.IdentifiableObject.Delete(DeleteEventArgs deleteEventArgs) at Tridion.ContentManager.IdentifiableObject.Delete() at Tridion.ContentManager.CoreService.CoreServiceBase.Delete(String id)
at SyncInvokeDelete(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at Tridion.ContentManager.CoreService.TransactionSupportInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
With used account I am able to manually delete item, that means that I have right permissions. Any help/suggestion about would be more than usable...
_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;
This code is used for impersonation. Inside the settings file I have option to decide whether the windows credentials will be used or credentials from the settings file. I got the error either using windows LDAP account or entering credentials manually. I haven't still tried to used SDL Administrator for this. I will try it and inform you about. Anyway, thank you for the effort
@UPDATE: I have tried using regular CoreService with basic http endpoint and still get the same error. So authentication don't cause problems here. It seems that something goes wrong with UGC events. Unfortunately I don't have code source neither have any additional information about UGC enabled dll.
Upvotes: 2
Views: 602
Reputation: 4835
The stacktrace is mentioning the UGCEventHandler, so I'm assuming UGC is installed, you could try temporarily disabling this event system and see if that helps, but I think its not the root of your problem as you mention you are able to manually delete with that user.
However you mention "...using core service in my application outside Tridion Content Manager machine", and also that you are using the Session Aware Core Service.
EDIT: So you are using the Session Aware Core Service Client and you are supplying a password too. That doesn't really add up, the Session Aware Core Service Client is supposed to be used in a situation where your user account is already authenticated, or when you are calling the Core Service though a valid SDL Tridion Impersonation user, upon which you impersonate the Core Service call to a valid SDL Tridion username by just the username (no password required).
Try using the regular Core Service Client as explained here: Get Core Service Client without config file.
Or if you insist on using the Session Aware Core Service Client (which I think is wrong in your case), make sure your application is running under a valid SDL Tridion Impersonation user (since you are running on an external server you need to add a domain account for that in the SDL Tridion MMC snap-in) and then impersonate the core service client like so:
using (SessionAwareCoreServiceClient client = new SessionAwareCoreServiceClient())
{
// impersonate with valid user
client.Impersonate("SDL Tridion Username here");
// use client
client.Delete(...);
}
Upvotes: 5