title: Autofac module registrations
body: <p>I have mostly used Ninject, so I apologize if I mix up terminology.</p>
  
  <p>I created a logger module to handle NLog using the destination class name as the logger name.  It is very similar to this: <a href="http://docs.autofac.org/en/latest/examples/log4net.html?highlight=log4net" rel="nofollow noreferrer">http://docs.autofac.org/en/latest/examples/log4net.html?highlight=log4net</a></p>
  
  <p>I also have a module created in my service layer that takes care of all of the service level registrations.  Looks like this:</p>
  
  <pre><code>public class ServiceModule : Module
  {
      protected override void Load(ContainerBuilder builder)
      {
         builder.Register(x =&gt; new AccountService(x.Resolve&lt;ILogger&gt;()))
              .As&lt;IAccountService&gt;()
              .InstancePerRequest();
      }
  }
  </code></pre>
  
  <p>Here is my autofac registration:</p>
  
  <pre><code>var builder = new ContainerBuilder();
  
  builder.RegisterControllers(Assembly.GetExecutingAssembly());
  builder.RegisterModule(new LoggingModule());
  builder.RegisterModule(new ServiceModule());
  
  var container = builder.Build();
  DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
  
  app.UseAutofacMiddleware(container);
  app.UseAutofacMvc();
  </code></pre>
  
  <p>At runtime, I get an exception saying ILogger has not been registered, am I missing something about how the modules work that is causing ILogger to not be visible in my service module?</p>