CMサーバーにパーソナライズのルールを適用する際のIRuleDeviceInformationManagerエラー


説明

パーソナライズのルールの追加、編集、またはパーソナライズを設定したページを訪問した場合、未処理の例外で失敗する可能性があります。この問題は、CMサーバーでデバイス検出ルールを使用する場合にのみ発生します。この事象が発生した場合、次のようなエラーをログで確認することができます:

ERROR Error in Mobile device processing.
Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Sitecore.Reflection.ReflectionUtil.CreateObject(Type type)
at Sitecore.Rules.DefaultRuleFactory.GetRuleCondition[T](Database database, XElement element)
at Sitecore.Rules.DefaultRuleFactory.GetRuleConditions[T](Database database, XElement element, Rule`1 result)
at Sitecore.Rules.DefaultRuleFactory.GetRule[T](Database database, XElement element)
at Sitecore.Rules.DefaultRuleFactory.ParseRules[T](Database database, XElement node)
at Sitecore.Rules.DefaultRuleFactory.GetRules[T](Field field)
at Sitecore.Rules.DefaultRuleFactory.GetRules[T](IEnumerable`1 items, String fieldName)
at Sitecore.Data.Items.DeviceItem.MatchesRules(HttpContextBase httpContext, SafeDictionary`2 customData)
at Sitecore.Data.Items.DeviceItem.ResolveHelper.FindBestMatch(Database database, HttpContextBase httpContext)
Nested Exception
Exception: System.InvalidOperationException
Message: No service for type 'Sitecore.CES.DeviceDetection.Rules.IRuleDeviceInformationManager' has been registered.
Source: Microsoft.Extensions.DependencyInjection.Abstractions
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Sitecore.ContentTesting.Rules.Conditions.DeviceTypeCondition`1..ctor()

この問題は、\App_Config\Sitecore\DeviceDetection.Client\ の設定ファイルに起因しています。このフォルダに含まれるファイルの設定はStandalone、Content DeliveryおよびProcessingロールにのみ適用されます。

解決策

この事象を解決するには、App_Config\Sitecore\DeviceDetection.Clientフォルダに含まれるすべてのファイルに次の変更を適用してください。

以下のコードを

<sitecore role:require="Standalone or ContentDelivery or Processing">

以下のコードに置換します。

<sitecore role:require="Standalone or ContentDelivery or Processing or ContentManagement">