3

This is an upgrade from Tridion 8.1 with DXA 1.5 .net to Tridion 9.6 and DXA 2.2.9 .net.

The DXA website is in a stage where everything is working except for the device detection, image resize functionality that depends on the Context Service.

The site.log shows the following error during initialization of DXA:

Sdl.Web.Tridion.Context.ContextServiceClaimsProvider..cctor:line 36: Failed to initialize the context engine.
Sdl.Web.Delivery.Service.InvalidServiceEndpoint: Invalid context engine service uri retrieved from discovery service.
   at Sdl.Web.Context.OData.Client.Caller.ODataContextEngineServiceClient..ctor()
   at Sdl.Web.Context.OData.Client.ODataContextEngine..ctor()
   at Sdl.Web.Tridion.Context.ContextServiceClaimsProvider..cctor() in C:\DXAGitHub\dxa-suite\repositories\dxa-web-application-dotnet\Sdl.Web.Tridion\Providers\Context\ContextServiceClaimsProvider.cs:line 36

Unity config points to the ContextServiceClaimsProvider:

<type type="IContextClaimsProvider" mapTo="ContextServiceClaimsProvider">
  <lifetime type="singleton" />
</type>

The strange part is that I can't find any errors in the discovery log, or context service log. Also the Topology Manager flyout in Tridion Content Explorer correctly shows the Context as a capability of the Discovery service:

Topology Manager flyout in TCME

The CD services are accessible from the website machine. They all use host names (not localhost). Firewall ports are open.

Running java -jar discovery-registration.jar read shows Context Service registered, up and running:

Registered capabilities on Discovery Service

Doing my troubleshooting, I found several resources mentioning this error; unfortunately none of them explain an actual solution:

Your thoughts are much appreciated and thank you in advance!

1
  • In the web,.config <add key="cid-localhost" value="localhost"/> - this config section needs adjustment
    – Velmurugan
    Commented Nov 25, 2022 at 7:58

1 Answer 1

2

The problem here was a mismatch of DLLs. Namely, the DLLs Sdl.Web.Context.OData.Client.dll and Sdl.Web.Delivery.Service.dll that DXA 2.2.9 .net WebApplication comes with are incompatible.

The constructor ODataContextEngineServiceClient() calls new ODataClientVersionChecking(endPointUri.ToString(), defaultTokenProvider); from DLL Sdl.Web.Delivery.Service.dll. However, there is only a default constructor in ODataClientVersionChecking.

The problem is solved by using the correct pair of DLLs. Tridion 9.6 DLLs work fine.

The real issue is the poor exception handling. There is one universal catch (Exception) which swallows the actual runtime error and spits out throw new InvalidServiceEndpoint("Invalid context engine service uri retrieved from discovery service."), which has actually nothing to do with the uri from DiscoveryService sadly. The original exception is lost entirely, so we don't know what actually happened.

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.