title: Autofac Exception: Cannot resolve parameter of constructor 'Void .ctor
body: <p>I have the following error:</p>
  
  <blockquote>
    <p>ExceptionMessage=None of the constructors found with
    'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type
    'RestAPI.DevelopersController' can be invoked with the available
    services and parameters: Cannot resolve parameter
    'Services.DevelopersService userService' of constructor 'Void
    .ctor(Services.DevelopersService)'.</p>
  </blockquote>
  
  <p><strong>Global.asax.cs</strong></p>
  
  <pre><code>protected void Application_Start()
      {
          GlobalConfiguration.Configure(WebApiConfig.Register);
          AutoMapperConfig.RegisterMappings();
          var builder = new ContainerBuilder();
          builder.RegisterModule(new ServiceModule());
          builder.RegisterModule(new ORMModule());
          builder.RegisterApiControllers(Assembly.GetExecutingAssembly()).PropertiesAutowired();
          var container = builder.Build();
          var resolver = new AutofacWebApiDependencyResolver(container);
          GlobalConfiguration.Configuration.DependencyResolver = resolver;
      }
  </code></pre>
  
  <p><strong>ServiceModule.cs</strong></p>
  
  <pre><code>public class ServiceModule : Autofac.Module
  {
      protected override void Load(ContainerBuilder builder)
      {
          builder.RegisterAssemblyTypes(Assembly.Load("Services"))
                   .Where(t =&gt; t.Name.EndsWith("Service"))
                   .AsImplementedInterfaces()
                   .InstancePerLifetimeScope();
      }
  }
  </code></pre>
  
  <p><strong>ORMModule.cs</strong></p>
  
  <pre><code>public class ORMModule : Autofac.Module
  {
      protected override void Load(ContainerBuilder builder)
      {
          builder.RegisterType(typeof(DatabaseContext)).As(typeof(DbContext)).InstancePerLifetimeScope();
      }
  }
  </code></pre>
  
  <p><strong>DevelopersController</strong></p>
  
  <pre><code>public class DevelopersController : ApiController
  {
      private DevelopersService _developersService;
  
      public DevelopersController(DevelopersService userService)
      {
          _developersService = userService;
          _developersService.SetIdentity(HttpContext.Current.Request.LogonUserIdentity.Name.ToString().Substring(4));
      }
  </code></pre>
  
  <p><strong>DevelopersService.cs</strong></p>
  
  <pre><code>public class DevelopersService : IService&lt;User&gt;
  {
      private DatabaseContext _db;
  
      public DevelopersService(DatabaseContext db)
      {
          _db = db;
      }
  
      public void SetIdentity(string username)
      {
  
      }
  
      public User Create(User entity)
      {
          return new User();
      }
      public User Read(User Id)
      {
          return new User();
      }
      public void Update(User user)
      {
  
      }
      public void Delete(User Id)
      {
  
      }
      public IEnumerable&lt;User&gt; GetAll()
      {
          return _db.Users.AsEnumerable();
      }
  }
  </code></pre>
  
  <p><strong>IService.cs</strong></p>
  
  <pre><code>public interface IService&lt;T&gt; where T : BaseEntity
  {
      void SetIdentity(string identity);
      T Create(T entity);
      T Read(T Id);
      void Update(T entity);
      void Delete(T Id);
      IEnumerable&lt;T&gt; GetAll();
  }
  </code></pre>
  
  <p>How can I fix it?</p>