Autofac 1.4 and earlier 2.1 versions used AutofacControllerModule as a way of finding and registering ASP.NET MVC controllers with the container.

In the Autofac 2.1 MVC integration, there is a new ContainerBuilder extension method called RegisterControllers.

var builder = new ContainerBuilder();

// Was:
// builder.RegisterModule(new AutofacControllerModule(...))

_containerProvider = new ContainerProvider(builder.Build());
                new AutofacControllerFactory(_containerProvider));

The reason for the switch is that RegisterControllers is a thin wrapper around the new assembly scanner, and supports the same syntax as the rest of Autofac’s registration methods:

  .OnActivated(e => Log.Information("Controller created: " + e.Instance));