diff --git a/src/Microsoft.AspNet.Hosting/WebHostBuilder.cs b/src/Microsoft.AspNet.Hosting/WebHostBuilder.cs index 55126d83b7..d3cb534555 100644 --- a/src/Microsoft.AspNet.Hosting/WebHostBuilder.cs +++ b/src/Microsoft.AspNet.Hosting/WebHostBuilder.cs @@ -92,12 +92,28 @@ namespace Microsoft.AspNet.Hosting _configureServices(services); } - if (PlatformServices.Default != null) + if (PlatformServices.Default?.Application != null) { services.TryAdd(ServiceDescriptor.Instance(PlatformServices.Default.Application)); + } + + if (PlatformServices.Default?.Runtime != null) + { services.TryAdd(ServiceDescriptor.Instance(PlatformServices.Default.Runtime)); + } + + if (PlatformServices.Default?.AssemblyLoadContextAccessor != null) + { services.TryAdd(ServiceDescriptor.Instance(PlatformServices.Default.AssemblyLoadContextAccessor)); + } + + if (PlatformServices.Default?.AssemblyLoaderContainer != null) + { services.TryAdd(ServiceDescriptor.Instance(PlatformServices.Default.AssemblyLoaderContainer)); + } + + if (PlatformServices.Default?.LibraryManager != null) + { services.TryAdd(ServiceDescriptor.Instance(PlatformServices.Default.LibraryManager)); }