0

As the title says, our project contains a a UITesting project that uses the ItemService to login and do perform actions such as create an item, check if an item exist, etc.

However for one of our Sitecore projects it's not working and when looking at logs I've noticed the following:

Exception: Sitecore.Mvc.Diagnostics.ControllerCreationException
Message: Could not create controller: 'ServicesAuthentication'. 
Source: Sitecore.Mvc
   at Sitecore.Mvc.Controllers.SitecoreControllerFactory.CreateController(RequestContext requestContext, String controllerName)
   at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory)
   at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Nested Exception

Exception: System.InvalidOperationException
Message: An error occurred when trying to create a controller of type 'Sitecore.Services.Infrastructure.Sitecore.Mvc.ServicesAuthenticationController'. Make sure that the controller has a parameterless public constructor.
Source: System.Web.Mvc
   at System.Web.Mvc.DefaultControllerFactory.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType)
   at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName)
   at Sitecore.Mvc.Controllers.SitecoreControllerFactory.CreateController(RequestContext requestContext, String controllerName)

Nested Exception

Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at System.Web.Mvc.DefaultControllerFactory.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType)

Nested Exception

Exception: System.TypeLoadException
Message: Could not load type 'System.IdentityModel.Tokens.JwtSecurityTokenHandler' from assembly 'System.IdentityModel.Tokens.Jwt, Version=5.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Source: Sitecore.Services.Infrastructure.Sitecore
   at Sitecore.Services.Infrastructure.Sitecore.Security.SigningTokenProvider..ctor(UserService userService, ConfigurationSettings configurationSettings, ILogger logger, ISigningProvider signingProvider)
   at Sitecore.Services.Infrastructure.Sitecore.Security.SigningTokenProvider..ctor()
   at Sitecore.Services.Infrastructure.Sitecore.Mvc.ServicesAuthenticationController..ctor()

We are running Sitecore.NET 8.2 (rev. 161221).
According to the documentation as far as I understand it, we should be able to use this API.

My question, do I have to use a different JwtSecurityTokenHandler and if so, how do I do this? Or is there another solution to this problem?

0

It turned out another project was loading in a newer version of this version

System.IdentityModel.Tokens.Jwt, Version=5.2.1.0

and this was conflicting with the one used by Sitecore 8.2. ( 4.0.20622.1351 )

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.