I have a mixed MVC 4 app, where some controllers are regular implementations of Controller
and some controllers are implementations of ApiController
.
To setup Autofac for Web.API you need to do two things:
Register the Autofac dependency resolver (in the App_Start):
GlobalConfiguration.Configuration.DependencyResolver =
new AutofacWebApiDependencyResolver(container);
And register your Api controllers in your container builder with the call:
containerBuilder.RegisterApiControllers(Assembly.GetExecutingAssembly());