React to hosting
This commit is contained in:
parent
8fb42e4d16
commit
226257020b
|
|
@ -5,10 +5,9 @@ using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Builder;
|
using Microsoft.AspNet.Builder;
|
||||||
using Microsoft.AspNet.Hosting;
|
using Microsoft.AspNet.Hosting;
|
||||||
|
using Microsoft.AspNet.Hosting.Startup;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.Framework.ConfigurationModel;
|
using Microsoft.Framework.ConfigurationModel;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
|
||||||
using Microsoft.Framework.Runtime.Infrastructure;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNet.WebSockets.Client.Test
|
namespace Microsoft.AspNet.WebSockets.Client.Test
|
||||||
{
|
{
|
||||||
|
|
@ -45,20 +44,14 @@ namespace Microsoft.AspNet.WebSockets.Client.Test
|
||||||
var config = new Configuration();
|
var config = new Configuration();
|
||||||
config.Add(new MemoryConfigurationSource());
|
config.Add(new MemoryConfigurationSource());
|
||||||
config.Set("server.urls", "http://localhost:54321");
|
config.Set("server.urls", "http://localhost:54321");
|
||||||
var services = HostingServices.Create(CallContextServiceLocator.Locator?.ServiceProvider, config)
|
|
||||||
.BuildServiceProvider();
|
|
||||||
var applicationLifetime = services.GetRequiredService<IApplicationLifetime>();
|
|
||||||
|
|
||||||
var context = new HostingContext()
|
var context = new HostingContext()
|
||||||
{
|
{
|
||||||
ApplicationLifetime = applicationLifetime,
|
|
||||||
Configuration = config,
|
Configuration = config,
|
||||||
ServerFactoryLocation = "Kestrel",
|
ServerFactoryLocation = "Kestrel",
|
||||||
ApplicationStartup = startup,
|
StartupMethods = new StartupMethods(startup, configureServices: null)
|
||||||
};
|
};
|
||||||
|
return new HostingEngine().Start(context);
|
||||||
var engine = services.GetRequiredService<IHostingEngine>();
|
|
||||||
return engine.Start(context);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue