Fix SelfHost to default to config environment
Fixes MusicStore
This commit is contained in:
parent
63c8e1889b
commit
2f02fc6091
|
|
@ -38,6 +38,10 @@ namespace Microsoft.AspNet.Hosting
|
|||
config.AddCommandLine(args);
|
||||
|
||||
var serviceCollection = HostingServices.Create(_serviceProvider, config);
|
||||
serviceCollection.AddInstance<IConfigureHostingEnvironment>(new ConfigureHostingEnvironment(env =>
|
||||
{
|
||||
env.EnvironmentName = config.Get(EnvironmentKey) ?? DefaultEnvironmentName;
|
||||
}));
|
||||
var services = serviceCollection.BuildServiceProvider();
|
||||
|
||||
var appEnv = services.GetRequiredService<IApplicationEnvironment>();
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ namespace Microsoft.AspNet.TestHost
|
|||
var services = HostingServices.Create(serviceProvider);
|
||||
services.AddSingleton<IConfigureHostingEnvironment, ConfigureTestHostingEnvironment>();
|
||||
|
||||
//var appServices = BuildFallbackServiceProvider(services, serviceProvider);
|
||||
var appServices = services.BuildServiceProvider();
|
||||
var config = new Configuration();
|
||||
return new TestServer(config, appServices, app);
|
||||
|
|
|
|||
Loading…
Reference in New Issue