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());
Probably this blog can help you: http://blogs.msdn.com/b/roncain/archive/2012/07/16/dependency-injection-with-asp-net-web-api-and-autofac.aspx