title: ASP.NET MVC 3: IDepencyResolver is trying to get an implementation of IControllerFactory
body: <p>Why is the <strong>IDependecyResolver</strong> trying to get an instance of <strong>IControllerFactory</strong> although I registered the <strong>DefaultControllerFactory</strong>?</p>
  
  <p><strong>Global.asax:</strong></p>
  
  <pre><code>ControllerBuilder.Current.SetControllerFactory(typeof(DefaultControllerFactory));
  DependencyResolver.SetResolver(new StructureMapDependencyResolver());
  </code></pre>
  
  <p><strong>Resolver:</strong></p>
  
  <pre><code>public class StructureMapDependencyResolver : IDependencyResolver
  {
      public static Func&lt;Type, object&gt; GetServiceViaDepencencyCallback = t =&gt;
      {
          throw new NotImplementedException(
              "StructureMapDependencyResolver is not configured!");
      };
  
      public static Func&lt;Type, IEnumerable&lt;object&gt;&gt; GetServicesViaDepencencyCallback = t =&gt;
      {
          throw new NotImplementedException(
              "StructureMapDependencyResolver is not configured!");
      };
  
      public object GetService(Type serviceType)
      {
          return GetServiceViaDepencencyCallback(serviceType);
      }
  
      public IEnumerable&lt;object&gt; GetServices(Type serviceType)
      {
          return GetServicesViaDepencencyCallback(serviceType);
      }
  }
  </code></pre>
  
  <p><strong>Thrown error:</strong></p>
  
  <blockquote>
    <p>StructureMap Exception Code:  202 No
    Default Instance defined for
    PluginFamily
    System.Web.Mvc.IControllerFactory,
    System.Web.Mvc, Version=3.0.0.0,
    Culture=neutral,
    PublicKeyToken=31bf3856ad364e35</p>
  </blockquote>