Mark's Sitecore Blog

Web API routes failing after updating to 8.1 Update-3

After updating to 8.1 Update-3 from 8.1 Initial Release our custom Web API routes on CM and CD were failing with the following exception:

	"Message":"An error has occurred.",
	"StackTrace":" at Sitecore.ExperienceAnalytics.Api.ApiContainer.CreateObject[T](String xpath)
		at Sitecore.ExperienceAnalytics.Api.ApiContainer.GetUserAccessGuard()
		at Sitecore.ExperienceAnalytics.Api.Http.Filters.DenyAnonymousUserFilterAttribute..ctor()
		at System.RuntimeTypeHandle.CreateCaInstance(RuntimeType type, IRuntimeMethodInfo ctor)
		at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
		at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
		at System.Web.Http.Controllers.HttpControllerDescriptor.InvokeAttributesOnControllerType(HttpControllerDescriptor controllerDescriptor, Type type)
		at System.Web.Http.Controllers.HttpControllerDescriptor..ctor(HttpConfiguration configuration, String controllerName, Type controllerType)
		at Sitecore.Services.Infrastructure.Web.Http.Dispatcher.NamespaceHttpControllerSelector.InitializeControllerDictionary()
		at System.Lazy`1.CreateValue()
		at System.Lazy`1.LazyInitValue()
		at Sitecore.Services.Infrastructure.Web.Http.Dispatcher.NamespaceHttpControllerSelector.FindMatchingController(String namespaceName, String controllerName)
		at Sitecore.Services.Infrastructure.Web.Http.Dispatcher.NamespaceHttpControllerSelector.SelectController(HttpRequestMessage request)
		at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()"

The problem lies in a missing config node “experienceAnalytics/api/logger”. After adding the node, the exception was gone.

UPDATE 20.06.16: Turns out, that we missed a config file from Update-2 during the upgrade process as we thought Update-3 would be cumulative. After fixing the configs it works without this patch. Thx to Sitecore support for pointing that out 🙂

Fix for CM Instances

You can use the following patch config to work around the issue:

Fix for CD Instances

Sitecore describes a way of working around WebApi issues on CD instances here.

They state:

If you have implemented custom code that uses ASP.NET Web API attribute routing, to avoid errors we recommend that you disable the following .dll files in the \Website\bin folder:


Although we are not specifically using attribute routing, this still solved the issue on CD instances.

Thanks to Andreas Gehrke for your post, which pointed me in the right direction.


Leave a Reply

Your email address will not be published. Required fields are marked *