Sitecore 8.2 update 7 upgrade - With default Solr Provider - WebApi routes not working

76 Views Asked by At

I am trying to upgrade to Sitecore 8.2 update 7 from Sitecore 8.1. We are using SimpleInjector for the dependency injection. As we are using Solr for our content search, I have the following in the initialize pipeline.

<pipelines>
 <initialize> 
   <processor type="Sitecore.ContentSearch.SolrProvider.Pipelines.Loader.InitializeSolrProvider, Sitecore.ContentSearch.SolrProvider"/> 
 </initialize>
</pipelines>

Now, the existing WebApi routes that we have are not working. They are also inside another initialize pipeline called zz.Pipelines.Config

<pipelines>
  <initialize>
    <processor type="Api.Global, Api" />
  </initialize>
</pipelines>

This is the .cs file for the Api.Global

using System.Diagnostics.CodeAnalysis;
using System.Web.Http;
using Sitecore.Pipelines;

namespace Api
{
  public class Global
  {
    public void Process(PipelineArgs args)
    {
      GlobalConfiguration.Configure(WebApiConfig.Register);
    }
  }
}

This is the error I see:

{
"Message": "An error has occurred.",
"ExceptionMessage": "An error occurred when trying to create a controller of type 'ContentItemDataController'. Make sure that the controller has a parameterless public constructor.",
"ExceptionType": "System.InvalidOperationException",
"StackTrace": " at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)\r\n at System.Web.Http.Controllers.HttpControllerDescriptor.CreateController(HttpRequestMessage request)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()",
"InnerException": {
"Message": "An error has occurred.",
"ExceptionMessage": "Type 'Api.Controllers.ItemApi.ContentItemDataController' does not have a default constructor",
"ExceptionType": "System.ArgumentException",
"StackTrace": " at System.Linq.Expressions.Expression.New(Type type)\r\n at System.Web.Http.Internal.TypeActivator.Create[TBase](Type instanceType)\r\n at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.GetInstanceOrActivator(HttpRequestMessage request, Type controllerType, Func`1& activator)\r\n at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)"
} }

Any help is appreciated.

0

There are 0 best solutions below