ASP.NET Core with existing IoC container & environment?
<p>I'd like to run the <em>ASP.NET Core</em> web stack along with <em>MVC</em> within a Windows service environment which already hosts an existing application in order to provide a frontend for it. The application uses Autofac for DI concerns which is nice because it already has an extension for <code>Microsoft.Extensions.DependencyInjection</code> (on which ASP.NET Core heavily relies upon).</p>

<p>Now, my problem is: ASP.NET Core wants to register its own services within the IoC container, at a stage where my own container has already been built. The only way I can see to run my own 'application part' along with ASP.NET Core is by setting up my application within the scope of the ASP.NET Core web host <code>Startup</code> class, what appears to make ASP.NET Core behaving like a full blown application framework rather than web framework. What I also tried is dropping the Startup completely and setting the web host up like this:</p>

<pre><code>        var containerBuilder    = new ContainerBuilder();
        var container           = containerBuilder.Build();
        var webHost             = new WebHostBuilder()
            .ConfigureServices(services =&gt;
            {
                services.AddMvc();
            })
            .Configure(app =&gt;
            {
                app.ApplicationServices = new AutofacServiceProvider(container);
                app.UseStaticFiles();
                app.UseMvc();
            })
            .UseKestrel()
            .UseIISIntegration()
            .Build();

        webHost.Run();
</code></pre>

<p>However this doesn't work because ASP.NET Core seems to override all configurations as soon as the web host is getting built. So, is there a way to integrate <em>ASP.NET Core</em> as well as <em>MVC</em> in an existing environment rather than the other way around? Maybe by setting it up manually rather than using <code>WebHostBuilder</code> etc.?</p>