diff --git a/src/Microsoft.AspNet.Hosting/Builder/HttpContextFactory.cs b/src/Microsoft.AspNet.Hosting/Builder/HttpContextFactory.cs index 9c03e2fcb1..8089252955 100644 --- a/src/Microsoft.AspNet.Hosting/Builder/HttpContextFactory.cs +++ b/src/Microsoft.AspNet.Hosting/Builder/HttpContextFactory.cs @@ -11,9 +11,7 @@ namespace Microsoft.AspNet.Hosting.Builder { public HttpContext CreateHttpContext(IFeatureCollection featureCollection) { - var featureObject = featureCollection ?? new FeatureObject(null); - var httpContext = new DefaultHttpContext(new FeatureCollection(featureObject)); - return httpContext; + return new DefaultHttpContext(featureCollection); } } } \ No newline at end of file diff --git a/src/Microsoft.AspNet.Hosting/HostingContext.cs b/src/Microsoft.AspNet.Hosting/HostingContext.cs index c3bcba3d26..f5dd096850 100644 --- a/src/Microsoft.AspNet.Hosting/HostingContext.cs +++ b/src/Microsoft.AspNet.Hosting/HostingContext.cs @@ -10,7 +10,7 @@ namespace Microsoft.AspNet.Hosting { public class HostingContext { - public IApplicationLifetime ApplicationLifeTime { get; set; } + public IApplicationLifetime ApplicationLifetime { get; set; } public IConfiguration Configuration { get; set; } public IApplicationBuilder Builder { get; set; } @@ -20,7 +20,7 @@ namespace Microsoft.AspNet.Hosting public Action ApplicationStartup { get; set; } public RequestDelegate ApplicationDelegate { get; set; } - public string ServerFactoryAssembly { get; set; } + public string ServerFactoryLocation { get; set; } public IServerFactory ServerFactory { get; set; } public IServerInformation Server { get; set; } } diff --git a/src/Microsoft.AspNet.Hosting/HostingEngine.cs b/src/Microsoft.AspNet.Hosting/HostingEngine.cs index 7b86e8ce42..930b5d1851 100644 --- a/src/Microsoft.AspNet.Hosting/HostingEngine.cs +++ b/src/Microsoft.AspNet.Hosting/HostingEngine.cs @@ -40,7 +40,7 @@ namespace Microsoft.AspNet.Hosting InitalizeServerFactory(context); EnsureApplicationDelegate(context); - var applicationLifetime = (ApplicationLifetime)context.ApplicationLifeTime; + var applicationLifetime = (ApplicationLifetime)context.ApplicationLifetime; var pipeline = new PipelineInstance(_httpContextFactory, context.ApplicationDelegate, _contextAccessor); var server = context.ServerFactory.Start(context.Server, pipeline.Invoke); @@ -70,7 +70,7 @@ namespace Microsoft.AspNet.Hosting return; } - context.ServerFactory = _serverManager.LoadServerFactory(context.ServerFactoryAssembly); + context.ServerFactory = _serverManager.LoadServerFactory(context.ServerFactoryLocation); } private void InitalizeServerFactory(HostingContext context) @@ -114,7 +114,9 @@ namespace Microsoft.AspNet.Hosting if (context.ApplicationStartup == null) { - throw new Exception(diagnosticMessages.Aggregate("TODO: web application entrypoint not found message", (a, b) => a + "\r\n" + b)); + throw new ArgumentException( + diagnosticMessages.Aggregate("Failed to find an entry point for the web application.", (a, b) => a + "\r\n" + b), + nameof(context)); } } diff --git a/src/Microsoft.AspNet.Hosting/Program.cs b/src/Microsoft.AspNet.Hosting/Program.cs index 96b1478529..db44580208 100644 --- a/src/Microsoft.AspNet.Hosting/Program.cs +++ b/src/Microsoft.AspNet.Hosting/Program.cs @@ -39,13 +39,13 @@ namespace Microsoft.AspNet.Hosting var appEnv = services.GetRequiredService(); var hostingEnv = services.GetRequiredService(); - var applicationLifeTime = services.GetRequiredService(); + var applicationLifetime = services.GetRequiredService(); var context = new HostingContext() { - ApplicationLifeTime = applicationLifeTime, + ApplicationLifetime = applicationLifetime, Configuration = config, - ServerFactoryAssembly = config.Get("server"), // TODO: Key names + ServerFactoryLocation = config.Get("server"), // TODO: Key names ApplicationName = config.Get("app") // TODO: Key names ?? appEnv.ApplicationName, EnvironmentName = hostingEnv.EnvironmentName, diff --git a/src/Microsoft.AspNet.Hosting/Startup/StartupLoader.cs b/src/Microsoft.AspNet.Hosting/Startup/StartupLoader.cs index 2fb227d5f1..e162cc07d5 100644 --- a/src/Microsoft.AspNet.Hosting/Startup/StartupLoader.cs +++ b/src/Microsoft.AspNet.Hosting/Startup/StartupLoader.cs @@ -92,7 +92,7 @@ namespace Microsoft.AspNet.Hosting.Startup { if (string.IsNullOrEmpty(applicationName)) { - throw new ArgumentNullException("applicationName"); + throw new ArgumentException("applicationName"); } var assembly = Assembly.Load(new AssemblyName(applicationName)); diff --git a/src/Microsoft.AspNet.TestHost/TestServer.cs b/src/Microsoft.AspNet.TestHost/TestServer.cs index ef7c53c2d1..a626723572 100644 --- a/src/Microsoft.AspNet.TestHost/TestServer.cs +++ b/src/Microsoft.AspNet.TestHost/TestServer.cs @@ -29,12 +29,12 @@ namespace Microsoft.AspNet.TestHost public TestServer(IConfiguration config, IServiceProvider serviceProvider, Action appStartup) { var appEnv = serviceProvider.GetRequiredService(); - var applicationLifeTime = serviceProvider.GetRequiredService(); + var applicationLifetime = serviceProvider.GetRequiredService(); HostingContext hostContext = new HostingContext() { ApplicationName = appEnv.ApplicationName, - ApplicationLifeTime = applicationLifeTime, + ApplicationLifetime = applicationLifetime, Configuration = config, ServerFactory = this, ApplicationStartup = appStartup diff --git a/test/Microsoft.AspNet.Hosting.Tests/HostingEngineTests.cs b/test/Microsoft.AspNet.Hosting.Tests/HostingEngineTests.cs index e8395c649f..2af5628080 100644 --- a/test/Microsoft.AspNet.Hosting.Tests/HostingEngineTests.cs +++ b/test/Microsoft.AspNet.Hosting.Tests/HostingEngineTests.cs @@ -35,11 +35,11 @@ namespace Microsoft.AspNet.Hosting var services = HostingServices.Create().BuildServiceProvider(); var engine = services.GetRequiredService(); - var applicationLifeTime = services.GetRequiredService(); + var applicationLifetime = services.GetRequiredService(); var context = new HostingContext { - ApplicationLifeTime = applicationLifeTime, + ApplicationLifetime = applicationLifetime, ServerFactory = this, ApplicationName = "Microsoft.AspNet.Hosting.Tests" };