I have a project in ASP.NET WebAPI that uses Core Service to CRUD components, when I try to create a component I have a FaultException'1 with this message :
{ "$id": "1", "Message": "An error has occurred.",
"ExceptionMessage": "Could not find endpoint element with name 'TridionCoreService' and contract 'Tridion.ContentManager.CoreService.Client.ICoreService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element.", "ExceptionType": "System.ServiceModel.FaultException`1[[Tridion.ContentManager.CoreService.Client.CoreServiceFault, Tridion.ContentManager.CoreService.Client, Version=6.1.0.996, Culture=neutral, PublicKeyToken=ddfc895746e5ee6b]]", "StackTrace": " Server stack trace: at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Tridion.ContentManager.CoreService.Client.ICoreService.Save(IdentifiableObjectData deltaData, ReadOptions readBackOptions) at Tridion.ContentManager.CoreService.Client.CoreServiceClient.Save(IdentifiableObjectData deltaData, ReadOptions readBackOptions) at .Web.Tridion.UI.Logic.TridionCoreServiceManager.CreatePageSettings(ConfigurationComponent args) in C:\\New folder\Sites\Dev\Tridion\*.Web.Tridion.UI\Logic\TridionCoreServiceManager.cs:line 116 at .Web.Tridion.UI.Logic.TridionCoreServiceManager.CreateConfigurationComponent(ConfigurationComponent args) in C:\\New folder\Sites\Dev\Tridion\*.Web.Tridion.UI\Logic\TridionCoreServiceManager.cs:line 97 at .Web.Tridion.UI.Controllers.TridionController.Create(ConfigurationComponent component) in C:\\New folder\Sites\Dev\Tridion\*.Web.Tridion.UI\Controllers\TridionController.cs:line 42 at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c_DisplayClassf.b_9(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.<>c_DisplayClass5.b_4() at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)"
}
I'm really surprised because I can read schemas :
using (var tridion = new CoreServiceAgent())
{
componentToCreate = tridion.Client.GetDefaultData(ItemType.Component,
ConfigurationContainerId) as ComponentData;
componentToCreate.Title = itemNumber.ToString();
schemaFields = tridion.Client.ReadSchemaFields("tcm:174-277976-8", true,
new ReadOptions());
Fields fields = new Fields(schemaFields, schemaFields.Fields,
componentToCreate.Content, "Configuration");
fields["Slogan"].AddValue(args.Slogan);
componentToCreate.Content = fields.OuterXml;
tridion.Client.Create(componentToCreate, new ReadOptions());
}
The exception is thrown when Create()
is called.
The configuration is written is web.config, I can read components but I can't save/create/update.
I suppose that's a generic exception (if I can read, I can create) but I don't get why and how to solve it, any suggestion is welcome.