3

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.

2

I am not sure about the CoreServiceAgent class, it looks like as a Wrapper or a Facade to the CoreServiceClient class, please check how the CoreServiceClient class is instantiated and check the endpoint that is being used (basicHttp, wsHttp, netTcp, ...).

Check if the WCF client configuration is located in your application Web.config file. In case you don't have the WCF client configuration in the Web.config file, it is also possible to configure an endpoint by code.

  • Yes, Core Service Agent is a Facade to CoreServiceClient. – Giu Do Jul 31 '13 at 7:41
0

Client configuration seems to be missing under service model. Refer below sample configuration

Example:

<system.serviceModel>
    <client>
      <endpoint name="TridionCoreService" address="XXXXX" binding="YYYYYY" 
                contract="Tridion.ContentManager.CoreService.Client.ICoreService"/>
    </client> 
</system.serviceModel>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.