title: Sitecore Could not create controller : Sitecore.Mvc.Diagnostics.ControllerCreationException
body: <p>I am using Sitecore v9</p>
  <p>I have a two base class for all my controllers as follows</p>
  <pre><code>public abstract SiteCoreController : ControllerBase, IController, IActionFilter, IAuthenticationFilter, IAuthorizationFilter, IDisposable, IExceptionFilter, IResultFilter, IAsyncController, IAsyncManagerContainer
  
  public abstract class ControllerBase : IController
  </code></pre>
  <p>All controllers use something like</p>
  <pre><code>public class MyPageController : SiteCoreController 
  </code></pre>
  <p>In my log files I get heaps of errors</p>
  <blockquote>
  <p>Sitecore.Mvc.Diagnostics.ControllerCreationException: Could not create
  controller:  The context item is: '/sitecore/content/TEST/home'. The
  current route url is: '{*pathInfo}'. This is the default Sitecore
  route which is set up in the 'InitializeRoutes' processor of the
  'initialize' pipeline. ---&gt; Sitecore.Mvc.Diagnostics.ExceptionWrapper:
  The controller for path '/' was not found or does not implement
  IController. at
  System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext
  requestContext, Type controllerType) at
  System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext
  requestContext, String controllerName) at
  Sitecore.Mvc.Controllers.SitecoreControllerFactory.CreateController(RequestContext
  requestContext, String controllerName)
  --- End of inner exception stack trace --- at Sitecore.Mvc.Controllers.SitecoreControllerFactory.CreateController(RequestContext
  requestContext, String controllerName) at
  Sitecore.Mvc.Controllers.ControllerRunner.GetController() at
  Sitecore.Mvc.Controllers.ControllerRunner.Execute() at
  Sitecore.Mvc.Pipelines.Request.RequestBegin.ExecuteFormHandler.ExecuteHandler(String
  controllerName, String actionName, RequestBeginArgs args) at (Object ,
  Object[] ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
  at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String
  pipelineName, PipelineArgs args, String pipelineDomain) at
  Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String
  pipelineName, TArgs args) at
  Sitecore.Mvc.Routing.RouteHttpHandler.BeginProcessRequest(HttpContext
  context, AsyncCallback cb, Object extraData) 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&amp;
  completedSynchronously)</p>
  </blockquote>
  <p>My DI is setup as follows</p>
  <pre><code>public static void SetupControllers(this IServiceCollection serviceCollection, params Assembly[] assemblyArray)
  {
      var controllers = GetTypesImplementing&lt;IController&gt;(assemblyArray)
          .Where(controller =&gt; controller.Name.EndsWith(&quot;Controller&quot;, StringComparison.Ordinal));
  
      foreach (var x in controllers)
      {
          serviceCollection.AddTransient(x);
      }
  
      var apis = GetTypesImplementing&lt;ApiController&gt;(assemblyArray)
          .Where(controller =&gt; controller.Name.EndsWith(&quot;Controller&quot;, StringComparison.Ordinal));
  
      foreach (var x in apis)
      {
          serviceCollection.AddTransient(x);
      }
  }
  </code></pre>