4

I'm trying to deploy a Sitecore xConnect instance in an XP0 configuration in my Test environment, however my CD servers keep getting a NotSupportedException when they try to use the xConnect API to query the data, with the message "Search operation not supported with xConnect collection-only configuration".

I've confirmed that the client certificate is working, as xConnect seems to be able to write data to the collection databases perfectly fine, however queries always return this exception. The bizarre thing is that the exact same instance in my dev environment works fine - I even did a diff across the two folders and only found expected differences (i.e. AppSettings.config(s) and ConnectionStrings.config(s)).

Note that the relevant files mentioned at https://doc.sitecore.net/developers/server-role-configuration-reference/xp-service-roles/xconnect-search/index.html (sc.XConnect.Collection.Initialize.xml, sc.XConnect.CollectionSearch.Initialize.xml and sc.XConnect.MarketingAutomation.Initialize.xml) are all enabled as well.

Stack Trace:

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Sitecore.XConnect.Search.SearchHelpers.<ExecuteSearch>d__6`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Sitecore.XConnect.Search.SearchDefinition`1.<Execute>d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Sitecore.XConnect.Search.AsyncSearchHitEnumerator`1.<Create>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Sitecore.XConnect.Search.AsyncEntityQueryProvider.<ExecuteAsync>d__8`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Sitecore.XConnect.Search.AsyncEntityQueryProvider.<ExecuteAsync>d__7`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MyProject.InitialSettings.<SetupPopularLinks>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MyProject.SettingsController.<GetInitialSettings>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<BeginInvokeAsynchronousActionMethod>b__36(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.<BeginInvokeAction>b__1c()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)

Code Snippet:

public async Task SetupPopularLinks()
{
    Guid definitionId = Guid.Parse("5D365D7A-847B-476A-B8DC-786C824F1435");
    List<string> guids = new List<string>(15);
    List<LinkItemClickEvent> events = new List<LinkItemClickEvent>();
    using (XConnectClient client = SitecoreXConnectClientConfiguration.GetClient())
    {
        var ints = await client.Interactions.Where(i => true).ToList();
        IAsyncQueryable<Interaction> queryable = client.Interactions.Where(x => x.LastModified > DateTime.Now.AddMonths(-3) //last three months only
            && x.Events.Any(y => y.DefinitionId == definitionId));

        var enumerable = await queryable.GetBatchEnumerator(200);
        var totalCount = enumerable.TotalCount;
        while (await enumerable.MoveNext())
        {
            var interactionBatch = enumerable.Current; // Batch of <= 200 interactions

            foreach (var interaction in interactionBatch)
            {
                events.AddRange(interaction.Events.OfType<LinkItemClickEvent>().ToList());
            }
        }

        var counts =
        events
        .GroupBy(e => e.ItemId)
        .Select(c => new { Key = c.Key, Count = c.Count() })
        .OrderByDescending(a => a.Count)
        .Take(15)
        .ToList();
        guids.AddRange(counts.Select(a => a.Key.ToString("B").ToUpperInvariant())); // React frontend needs uppercase for matching of guids
    }
    PopularLinks = guids;
}
1
  • Thank you for the post! I'm trying to do a similar thing and your tip helped me to get rid of "Search operation not supported with xConnect collection-only configuration" exception. But afterwards, I received another one: > 2019-12-27T14:19:25 PID[4840] Error 8456 14:19:25 ERROR > [vl_public] Getting of Poll Voting Results error : Exception: > Sitecore.XConnect.XdbSearchUnavailableException Message: The HTTP > response was not successful: InternalServerError Source: > Sitecore.Xdb.Common.Web at > Sitecore.Xdb.Common.Web.Synchronous.SynchronousExtensions.SuspendContextLock[TResult](Func`1 > tas Commented Dec 27, 2019 at 14:45

1 Answer 1

8

I ended up finding the solution - there was never an issue with the XConnect instance, but with the configuration on the CD Sitecore instance.

The issue is that by default, Content Delivery servers are set to only use xConnect as a collection-only endpoint.

To change this, update the config in the sitecore/xconnect/clientconfig node and add a "searchConnectionStringName" parameter as below, which will be missing from the ContentDelivery role section. By default this config is located in App_Config/Sitecore/XConnect.Client.Configuration/Sitecore.XConnect.Client.config

<clientconfig type="Sitecore.XConnect.Client.Configuration.SitecoreXConnectClientConfiguration,Sitecore.XConnect.Client.Configuration"
              singleInstance="true"
              role:require="ContentDelivery or Processing or Reporting and !ContentManagement and !Standalone">
        <param desc="clientModel" ref="xconnect/runtime" />
        <param desc="collectionConnectionStringName">xconnect.collection</param>
        <param desc="searchConnectionStringName">xconnect.collection</param>
        <param desc="configurationConnectionStringName">xconnect.collection</param>
</clientconfig>
2
  • Already the config is there in cm server with the mentioned node, but still getting the error.any suggestion on this?
    – Debaparna
    Commented Sep 15, 2022 at 16:30
  • This config needs to be updated on your CD servers - the problem is that since the CD instance is configured as 'collection-only' it throws an error if it tries to write data to XConnect. Commented Jan 24, 2023 at 23:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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