commit
7e7d101dcf
|
|
@ -79,7 +79,7 @@ namespace Microsoft.AspNetCore.Hosting
|
||||||
throw new ArgumentNullException(nameof(configureApp));
|
throw new ArgumentNullException(nameof(configureApp));
|
||||||
}
|
}
|
||||||
|
|
||||||
var startupAssemblyName = configureApp.Target.GetType().GetTypeInfo().Assembly.GetName().Name;
|
var startupAssemblyName = configureApp.GetMethodInfo().DeclaringType.GetTypeInfo().Assembly.GetName().Name;
|
||||||
|
|
||||||
return hostBuilder.UseSetting(WebHostDefaults.ApplicationKey, startupAssemblyName)
|
return hostBuilder.UseSetting(WebHostDefaults.ApplicationKey, startupAssemblyName)
|
||||||
.ConfigureServices(services =>
|
.ConfigureServices(services =>
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting.Fakes;
|
using Microsoft.AspNetCore.Hosting.Fakes;
|
||||||
using Microsoft.AspNetCore.Hosting.Internal;
|
using Microsoft.AspNetCore.Hosting.Internal;
|
||||||
using Microsoft.AspNetCore.Hosting.Server;
|
using Microsoft.AspNetCore.Hosting.Server;
|
||||||
|
|
@ -478,6 +479,21 @@ namespace Microsoft.AspNetCore.Hosting
|
||||||
Assert.Equal(PlatformServices.Default.Application.ApplicationBasePath, appEnv.ApplicationBasePath);
|
Assert.Equal(PlatformServices.Default.Application.ApplicationBasePath, appEnv.ApplicationBasePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Configure_SupportsStaticMethodDelegate()
|
||||||
|
{
|
||||||
|
var host = new WebHostBuilder()
|
||||||
|
.UseServer(new TestServer())
|
||||||
|
.Configure(StaticConfigureMethod)
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var hostingEnv = host.Services.GetService<IHostingEnvironment>();
|
||||||
|
Assert.Equal("Microsoft.AspNetCore.Hosting.Tests", hostingEnv.ApplicationName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void StaticConfigureMethod(IApplicationBuilder app)
|
||||||
|
{ }
|
||||||
|
|
||||||
private IWebHostBuilder CreateWebHostBuilder()
|
private IWebHostBuilder CreateWebHostBuilder()
|
||||||
{
|
{
|
||||||
var vals = new Dictionary<string, string>
|
var vals = new Dictionary<string, string>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue