title: Register autofac in windows service project
body: <p>I want to use autofac in my project for windows service but I get this error:</p>
  
  <p>"The requested service 'InsideView.Business.Services.BusinessServiceFactory' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency."</p>
  
  <p>My code:</p>
  
  <pre><code>       var builder = new ContainerBuilder();
  
         foreach (var type in typeof(IMyService).Assembly.GetTypes().Where(type =&gt; type.Name.EndsWith("Service") &amp;&amp; type.IsClass))
          {
              var siblingInterface = type.GetInterfaces().First(i =&gt; i.Name == "I" + type.Name);
              builder.RegisterType(type).Keyed(siblingInterface, typeof(IBusinessService)).InstancePerLifetimeScope();
          }
  
          builder.RegisterType&lt;BusinessServiceFactory&gt;()
              .As&lt;IBusinessServiceFactory&gt;().InstancePerLifetimeScope();
  
  
          IContainer container = builder.Build();
  
         var businessFactory = container.Resolve&lt;BusinessServiceFactory&gt;()
  </code></pre>
  
  <p>Any ideas?
  Thanks</p>