I found out through a collegue that i was poking at the wrong place, it doesnt matter how i setup the container because the code that bootstraps this is not the DependencyResolver.
I added this line to my code, when setting up the server:
httpConf.Services.Replace(typeof(IHttpControllerTypeResolver), new AutofacHttpControllerTypeResolver(container));
and this is how my autofacHttpControllerTypeResolver class looks like:
class AutofacHttpControllerTypeResolver : IHttpControllerTypeResolver
{
private readonly IContainer _container;
public AutofacHttpControllerTypeResolver(IContainer container)
{
this._container = container;
}
public ICollection<Type> GetControllerTypes(IAssembliesResolver assembliesResolver)
{
var q = from r in _container.ComponentRegistry.Registrations
let t = r.Activator.LimitType
where typeof(IHttpController).IsAssignableFrom(t) && t.Name.EndsWith("Controller")
select t;
return q.ToList();
}
}