You have overriden the DefaultControllerFactory
. But this is used to instantiate ASP.NET MVC controllers (one deriving from System.Web.Mvc.Controller
). It has strictly nothing to do with ASP.NET Web API controllers (the ones deriving from System.Web.Http.ApiController
).
So basically what you have done here is dependency injection into ASP.NET MVC. If you want to use this for the Web API you may take a look at the following guides: