title: 'ConfigureServices returning a System.IServiceProvider isn't supported.'
body: <p>I need ti use this <code>AutoFac</code> in ASP core 3.0</p>
  
  <p>When I use this code in startu up:</p>
  
  <pre><code>public IServiceProvider ConfigureServices(IServiceCollection services)
  {
      services.AddControllers();
      return services.BuildAutofacServiceProvider();
  }
  </code></pre>
  
  <p>It show me this error:</p>
  
  <blockquote>
    <p>'ConfigureServices returning an System.IServiceProvider isn't supported.'</p>
  </blockquote>
  
  <p>And I change the program.cs by this:</p>
  
  <pre><code>public class Program
  {
      public static void Main(string[] args)
      {
          CreateHostBuilder(args).Build().Run();
      }
  
      public static IHostBuilder CreateHostBuilder(string[] args) =&gt;
          Host.CreateDefaultBuilder(args)
          .UseServiceProviderFactory(new AutofacServiceProviderFactory())
              .ConfigureWebHostDefaults(webBuilder =&gt;
              {
                  webBuilder.UseStartup&lt;Startup&gt;();
              });
  }
  </code></pre>
  
  <p>But it not solved.</p>
  
  <p>This is <code>BuildAutofacServiceProvider()</code> Code:</p>
  
  <pre><code>public static IServiceProvider BuildAutofacServiceProvider(this IServiceCollection services)
  {
      var ContainerBuilder = new ContainerBuilder();
      ContainerBuilder.Populate(services);
      ContainerBuilder.AddService();
      var container = ContainerBuilder.Build();
  
      return new AutofacServiceProvider(container);
  }
  </code></pre>
  
  <p>How can I solve this problem?</p>